1. 卸载已有版本linux
yum remove vsftpdvim
2. 安装浏览器
yum install -y vsftpd服务器
3. 建立文件服务器根目录rest
mkdir /ftpfileip
4. 建立ftp服务器用户ci
useradd ftpuser -d /ftpfile -s /sbin/nologin #新增用户rem
chown -R ftpuser.ftpuser /ftpfile #设置用户目录it
passwd ftpuser #设置用户密码table
5. 修改 vsftpd 配置文件
vim /etc/vsftpd/vsftpd.conf
新增以下行:
local_root=/ftpfile
anon_root=/ftpfile
use_localtime=yes
allow_writeable_chroot=YES
pasv_min_port=61001
pasv_max_port=62000
修改以下行:(修改后)
anonymous_enable=NO
ftpd_banner=Welcome to xx FTP Service
chroot_list_enable=YES
chroot_list_file=/etc/vaftpd/chroot_list
新建 /etc/vsftpd/chroot_list
添加内容:
ftpuser
6. 修改防火墙配置
vim /etc/sysconfig/iptables
添加以下内容
-A INPUT -p TCP --dport 61001:62000 -j ACCEPT
-A OUTPUT -p TCP --sport 61001:62000 -j ACCEPT
-A INPUT -p TCP --dport 20 -j ACCEPT
-A OUTPUT -p TCP --dport 20 -j ACCEPT
-A INPUT -p TCP --dport 21 -j ACCEPT
-A OUTPUT -p TCP --dport 21 -j ACCEPT
7. 重启防火墙
service iptables restart
8. 修改 selinux
vim /etc/selinux/config
将 SELINUX=enforcing 修改成 SELINUX=disabled
使 selinux 生效:
setenforce 0
9. 重启 vsftpd
service vsftpd restart
10. 验证
浏览器访问 ftp://ip