0. 关闭selinux

永久性关闭(这样需要重启服务器后生效)
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
临时性关闭(立即生效,但是重启服务器后失效)
setenforce 0 #设置selinux为permissive模式(即关闭)
setenforce 1 #设置selinux为enforcing模式(即开启)

1. 查看是否安装

rpm -qa | grep vsftp

2. 安装vsftp

yum install vsftpd -y

3. 修改主配置文件

# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# 是否允许匿名登录FTP服务器,默认设置为YES(允许)
anonymous_enable=NO
#
# 是否允许本地用户登录FTP服务器,默认设置为YES(允许)
local_enable=YES
#
# 是否允许用户(匿名用户、本地用户)对FTP服务器具有写权限,默认设置为YES(允许)
write_enable=YES
#
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)
# 设置本地用户的文件生成掩码,默认为022
local_umask=022
#
# Uncomment this to allow the anonymous FTP user to upload files. This only
# has an effect if the above global write enable is activated. Also, you will
# obviously need to create a directory writable by the FTP user.
# 是否允许匿名用户上传文件,默认设置为YES(允许)。
#anon_upload_enable=YES
#
# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
# 是否允许匿名用户创建新文件夹。默认设置为YES(允许)
#anon_mkdir_write_enable=YES
#
# Activate directory messages - messages given to remote users when they
# go into a certain directory.
# 是否激活目录欢迎信息功能,当用户首次访问服务器上的某个目录时,FTP服务器将显示欢迎信息。默认情况下,欢迎信息是通过目录下的.message文件获得的
dirmessage_enable=YES
#
# The target log file can be vsftpd_log_file or xferlog_file.
# This depends on setting xferlog_std_format parameter
# 是否启用上传和下载记录日志的功能
xferlog_enable=YES
# 在FTP服务器中设置欢迎登录信息。当用户登录到FTP服务器后,会看到欢迎细信息“Welcome to blah FTP service.”
ftpd_banner=Welcome to blah FTP service
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can arrange for uploaded anonymous files to be owned by
# a different user. Note! Using "root" for uploaded files is not
# recommended!
#chown_uploads=YES
#chown_username=whoever
#
# The name of log file when xferlog_enable=YES and xferlog_std_format=YES
# WARNING - changing this filename affects /etc/logrotate.d/vsftpd.log
xferlog_file=/var/log/xferlog
#
# Switches between logging into vsftpd_log_file and xferlog_file files.
# NO writes to vsftpd_log_file, YES to xferlog_file
xferlog_std_format=YES
#
# You may change the default value for timing out an idle session.
# 如果用户在600秒内没有命令操作,强制脱机,避免占用资源
idle_session_timeout=600
#
# You may change the default value for timing out a data connection.
# 如果服务器和客户端的数据连接已经成功建立,但是可能由于线路问题导致在120秒内还是无法顺利地完成数据的传送,客户端的连接就会被vsftpd强制剔除
#data_connection_timeout=120
#
# It is recommended that you define on your system a unique user which the
# ftp server can use as a totally isolated and unprivileged user.
#nopriv_user=ftpsecure
#
# Enable this and the server will recognise asynchronous ABOR requests. Not
# recommended for security (the code is non-trivial). Not enabling it,
# however, may confuse older FTP clients.
#async_abor_enable=YES
#
# By default the server will pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to have the server actually do ASCII
# mangling on files when in ASCII mode.
# Beware that on some FTP servers, ASCII support allows a denial of service
# attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd
# predicted this attack and has always been safe, reporting the size of the
# raw file.
# ASCII mangling is a horrible feature of the protocol.
# 当设置为YES时,表示允许使用ASCII方式上传和下载文件
#ascii_upload_enable=YES
#ascii_download_enable=YES
#
# You may fully customise the login banner string:
#ftpd_banner=Welcome to blah FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# useful for combatting certain DoS attacks.
#deny_email_enable=YES
# (default follows)
#banned_email_file=/etc/vsftpd/banned_emails
#
# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
#chroot_local_user=YES
#是否锁定根目录(只能在指定给自己的目录下做为根目录)
#每行写FTP用户名就行
chroot_list_enable=YES
#允许写入
#allow_writeable_chroot=YES
# (default follows)
# 锁定FTP用户在自己目录下面,不写入的话有可能会直接显示根目录!
chroot_list_file=/etc/vsftpd/chroot_list
#
# You may activate the "-R" option to the builtin ls. This is disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# the presence of the "-R" option, so there is a strong case for enabling it.
#ls_recurse_enable=YES
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
# 当设置为YES时,则vsftpd将以独立模式运行,由vsftpd自己监听和处理连接请求
listen=YES
#
# This directive enables listening on IPv6 sockets. To listen on IPv4 and IPv6
# sockets, you must run two copies of vsftpd with two configuration files.
# Make sure, that one of the listen options is commented !!
#listen_ipv6=YESpam_service_name=vsftpd
# userlist_enable=NO时ftpusers文件中的用户将禁止访问FTP服务器。因此ftpusers文件又被称为“禁止使用vsftpd的用户列表文件”
userlist_enable=YES
# 当userlist_enable为YES,userlist_deny为NO时,FTP服务器仅允许user_list中的用户访问
# 当userlist_enable为YES,userlist_deny为YES时,ftpusers和user_list文件中的用户均不能访问FTP服务器
# userlist_deny
tcp_wrappers=YES
#用来存放每个需要独立的FTP用户的配置
user_config_dir=/etc/vsftpd/userconfig
#centos7 开启
#allow_writeable_chroot=YES

备份原配置文件后直接复制即可,创建虚拟用户

vim /etc/vsftpd/chroot_list
ftpuser

4. 指定用户根目录

mkdir /etc/vsftpd/userconfig
echo local_root=/var/ftp/ftpuser > /etc/vsftpd/userconfig/ftpuser

5. 创建用户

useradd -s /sbin/nologin -g ftp ftpuser && echo 你的密码 | passwd --stdin ftpuser

6. 创建用户FTP所能管理的目

mkdir /var/ftp/ftpuser
#把所建的目录给相应的账号主权限
chown -R ftpuser:ftp /var/ftp/ftpuser

7. 关闭防火墙

# 注意linux的版本# CentOs 6
# 查看防火墙是否开启
service iptables status
# 临时关闭防火墙
servcie iptables stop
# 永久性关闭防火墙
service iptables off# CentOs 7+
# 查看防火墙是否开启
firewall-cmd --state
#临时关闭防火墙
systemctl stop firewalld.service
#永久关闭防火墙(重启生效)
systemctl disable firewalld.service

8. 启动VSFTP服务

service vsftpd start

转载于:https://www.cnblogs.com/eRrsr/p/10077105.html

CenOS_6.6_简单搭建vsFTP相关推荐

  1. DHCP服务、NFS、vsftp服务的简单搭建

    DHCP服务.NFS.vsftp服务的简单搭建与小实验测试 转载于:https://blog.51cto.com/nmgxjh/1426742

  2. python简易版实例_Python3之简单搭建自带服务器的实例讲解

    WEB开发,我们先从搭建一个简单的服务器开始,Python自带服务模块,且python3相比于python2有很大不同, 在Python2.6版本里,/usr/bin/lib/python2.6/ 目 ...

  3. 十分钟用Windows服务器简单搭建DHCP中继代理!!

                         十分钟用Windows服务器简单搭建DHCP中继代理!! 一.什么是中继代理? 大家都知道DHCP分配地址都需要用到IP广播,但是广播是不能在两个网段之间进行 ...

  4. 关于在linux下搭建VSFTP下匿名不能上传的问题

    关于在linux下搭建VSFTP下匿名不能上传的问题:   在/etc/vsftpd/vsftpd.conf(vsftpd的核心配置文件)中  配置如下:  anonymous_enable=YES( ...

  5. RHEL4- SAMBA服务(四)在x-window下图形界面简单搭建samba服务器

    RHEL4- SAMBA服务(四)在x-window下图形界面简单搭建samba服务器       在<RHEL4- SAMBA服务(一)samba服务的安装与启动>中我讲了如何安装和启动 ...

  6. 简单搭建一个SSM项目(一)

    简单搭建一个用户管理的SSM项目框架,虽然也能用servlet+jdbc搭建更简单的,不过个人感觉工作中更多用的ssm框架项目,这里就简单用ssm来搭建需要的项目吧. 准备工具:eclipse.jdk ...

  7. 摄影平铺海报psd模板|简单搭建层次场景海报

    大家肯定都看过那种 平铺的俯视图场景海报 用潮流颜色元素铺满海报 中间空位放上主题文字 看起来似乎很简单的样子 但为什么每次自己设计总觉得缺了点什么 平平无奇,没有什么层次感 事实上设计这种海报并不简 ...

  8. Linux、CentOS简单搭建虚拟主机

    Linux.CentOS简单搭建虚拟主机(仅供参考) 1.       基于域名的虚拟主机 a.       新建目录/usr/local/webapps/123 b.       在123目录下面新 ...

  9. CA服务器的简单搭建

    CA服务器的简单搭建 一.简单介绍 CA 也拥有一个证书(内含公钥和私钥).网上的公众用户通过验证 CA 的签字从而信任 CA ,任何人都可以得到 CA 的证书(含公钥),用以验证它所签发的证书. 如 ...

最新文章

  1. 20175318 2018-2019-2 《Java程序设计》第4周学习总结
  2. 数据库的定义、模型 和 模式
  3. 【转】SAP PS 模块简介
  4. JAVA获取项目工程下的文件
  5. 107. 二叉树的层次遍历 II
  6. linux网络服务偶尔失效,判断linux下的网络服务是否正常启动
  7. C# DataGridView 动态添加列和调整列顺序
  8. Spring 3.0: Unable to locate Spring NamespaceHandler for XML schema namespace
  9. 根据TTL值判断目标主机的类型
  10. 无法获得锁 /var/cache/apt/archives/lock - open (11: 资源暂时不可用)
  11. oracle笔记整理14——性能调优之oracle执行计划
  12. STM32 W5500 MQTT Client 发布订阅及断线重连
  13. 修改form表单action路径
  14. 百度paddlepaddle七天打卡之青你实战
  15. android 各个手机型号的功放和听筒模式的研究
  16. link js重构心得
  17. (免费分享)基于jsp,javaweb银行柜员业务绩效考核系统(带论文)
  18. window10下运行激活软件时会提示病毒文件,并且自动删除问题
  19. [work]马尔可夫链 (Markov Chain)是什么鬼
  20. 微信小程序 - text 标签头部有空白间距

热门文章

  1. cmake and cmake-gui读的环境变量不一致
  2. linux内核计算次方,linux内核中的循环缓冲去的设计与实现
  3. 跨区域报考计算机考试可以吗,考生注意!2020年医师资格机考跨题型不可以回看(附上机操作系统)...
  4. 怎样设计访谈提纲_访谈提纲设计
  5. java输出各国人的问候语_世界各国问候语及发音.doc
  6. 2016学计算机软件,2016年夏季学期计算机(软件)学院学年论文字数、页数和格式要求.doc...
  7. hdu 4302 Holedox Eating
  8. 《Android Property
  9. Inf2Cat, signability test failed.驱动编译出错
  10. MySql 使用规范推荐(转)