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