自用的話,建議先關掉防火牆
systemctl stop firewalld #關閉防火牆
systemctl disable firewalld.service #設置開機禁用防火牆
systemctl start firewalld #啟動防火牆
systemctl enable firewalld.service #設置開機啟用防火牆
systemctl status firewalld #檢查防火牆狀態
1. 安裝ftp
yum -y install vsftpd
查看
vsftpd -v
2. 取消匿名登陸
修改vsftpd.conf文件
vi /etc/vsftpd/vsftpd.conf
把 anonymous_enable=YES,改為NO,然后重啟vsftpd
3、設置開機啟動
chkconfig vsftpd on
4、啟動ftp服務
service vsftpd start
檢查服務狀態
service vsftpd status
停止服務:
service vsftpd stop
重啟服務
service vsftpd restart
5. vi /etc/selinux/config
# This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. #SELINUX=enforcing # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. #SELINUXTYPE=targeted SELINUX=disabled
6. 關閉防火牆
setenforce 0 #設置SELinux 成為permissive模式 臨時關閉selinux的防火牆
查看SELinux狀態
getenforce
修改好之后,reboot重啟下,然后執行getenforce命令查看SELinux狀態
再次查看SELinux狀態
顯示 Disabled
7.獲取本地IP地址
ip address
找到類似192.168.x.x的IP地址,記下來
8. 連接FTP

打開xshell,新建會話,輸入192.168.x.x,點擊連接,根據提示,輸入用戶名密碼即可(用戶名是當前用戶root,密碼是進入linux系統的密碼,連接就可以了)。
原文地址:在虛擬機中安裝ftp_ITPUB博客
