1、安裝vsftpd這款ftp服務(wù)器軟件,命令如下:
yum install -y vsftpd
2、設(shè)置vsftpd服務(wù)開機(jī)自啟動,然后重啟服務(wù),查看ftp服務(wù)端口,命令如下:
#chkconfig vsftpd on #systemctl enabled vsftpd.service #systemctl restart vsftpd.service #netstat -antup|grep ftp
安裝完成后需要重啟vsftpd服務(wù)。
3、編輯vsftpd主配置文件/etc/vsftpd/vsftpd.conf
修改anonymous_enable = NO,這樣可以禁止匿名登錄。
去掉chroot_local_user = yes前的注釋,限制用戶訪問家目錄之外的地方。
4、創(chuàng)建ftp用戶,設(shè)置用戶無法登錄服務(wù)器系統(tǒng)并且家目錄在/var/www/html下
5、給其他人修改文件夾的權(quán)限:chmod o+w /var/www/html/
6、關(guān)掉selinux
vi /etc/selinux/config
重啟系統(tǒng)。
在系統(tǒng)內(nèi)部嘗試自己訪問, ftp ip地址,應(yīng)該能成功登陸,繼續(xù)配置外網(wǎng)訪問
7、關(guān)閉防火墻
systemctl stop firewalld.service
推薦教程:centos教程