在CentOS系统中,使用firewalld作为默认的防火墙管理工具,配置VSFTPD的防火墙规则需要以下步骤:
sudo systemctl status firewalld
如果服务未启动,请使用以下命令启动:
sudo systemctl start firewalld
sudo firewall-cmd --permanent --add-service=ftp
/etc/vsftpd/vsftpd.conf
),找到或添加以下行:pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
这里的端口号范围可以根据需要进行调整。保存并关闭配置文件。
sudo firewall-cmd --permanent --zone=public --add-port=1024-1048/tcp
sudo firewall-cmd --reload
/etc/selinux/config
文件,将SELINUX=enforcing
更改为SELINUX=permissive
,然后重启系统。或者,您可以使用以下命令临时将SELinux设置为宽容模式:sudo setenforce 0
注意:将SELinux设置为宽容模式可能会降低系统的安全性。在解决问题后,请务必将SELinux恢复为强制模式。
完成以上步骤后,VSFTPD应该已经可以通过防火墙正常工作了。如果仍然遇到问题,请检查VSFTPD配置文件以确保所有设置都正确。