安装 vsftpd
yum install -y vsftpd
编辑 ftp 配置文件
vi /etc/vsftpd/vsftpd.conf
anonymous_enable=NO
#anonymous_enable=YES
chroot_local_user=YES
#去掉前面的注释
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list
#不受限制的用户列表,用不用都OK
allow_writeable_chroot=YES
#加上这行解决了无法登陆的问题
启动/重新启动 ftp
service vsftpd start
service vsftpd restart
设置开机启动ftp
chkconfig vsftpd on
防火墙配置 (iptables)
#安装iptables防火墙
yum install iptables-services #安装
vi /etc/sysconfig/iptables
在 iptables 中开发 21 端口,CentOS7 中默认开启的是 firewall 防火墙,可以参考 http://help.aliyun.com/knowledge_detail/6700252.html?spm=5176.7618386.5.3.AeHhDY 设置 iptables 防火墙
-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
防火墙重新启动
#service iptables restart
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
建立ftp账户
#为 /path/you/want 目录创建 ftpUserName 用户
useradd -d /path/you/want -s /sbin/nologin ftpUserName
修改密码
passwd ftpUserName
设置账户权限
chown -R ftpUserName.ftpUserName /path/you/set
原文:http://www.centoscn.com/image-text/install/2015/0227/4748.html
备注:如果客户端 ftp 连接不成功,可以参考 http://blog.youkuaiyun.com/u011310774/article/details/49658867