1.查看ftp端口21是否开放
firewall-cmd --permanent --query-port=21/tcp
2.开放21端口
[root@localhost ~]# firewall-cmd --permanent --add-port=21/tcp
success
[root@localhost ~]# firewall-cmd --reload
3.查看ftp状态
service vsftpd status
[root@localhost ~]# service vsftpd status
Redirecting to /bin/systemctl status vsftpd.service
● vsftpd.service - Vsftpd ftp daemon
Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled)
Active: active (running) since 二 2020-06-30 14:28:09 CST; 20s ago
Process: 1957 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS)
Main PID: 1959 (vsftpd)
Tasks: 1
Memory: 752.0K
CGroup: /system.slice/vsftpd.service
└─1959 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
6月 30 14:28:09 localhost.localdomain systemd[1]: Starting Vsftpd ftp daemon...
6月 30 14:28:09 localhost.localdomain systemd[1]: Started Vsftpd ftp daemon.
4.允许root用户通过ftp访问
vi /etc/vsftpd/ftpusers
注释掉root用户
#root
bin
daemon
adm
lp
sync
shutdown
halt
mail
news
uucp
operator
games
nobody
vi /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
#注释掉root用户
#root
bin
daemon
adm
lp
sync
shutdown
halt
mail
"/etc/vsftpd/user_list" 20L, 362C written
5.重启ftp服务
[root@localhost ~]# service vsftpd restart
Redirecting to /bin/systemctl restart vsftpd.service