在 CentOS 上启动 vsftpd(Very Secure FTP Daemon)通常有以下几种方式,取决于你使用的是 CentOS 6(SysVinit) 还是 CentOS 7/8(systemd)。
rpm -qa | grep vsftpd
如果没有安装:
yum install vsftpd -y
systemctl start vsftpd
systemctl enable vsftpd
systemctl status vsftpd
systemctl restart vsftpd
systemctl stop vsftpd
service vsftpd start
chkconfig vsftpd on
如果连不上,通常是防火墙或 SELinux 问题。
firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --reload
在 /etc/vsftpd/vsftpd.conf 中指定:
pasv_min_port=30000
pasv_max_port=31000
然后开放端口:
firewall-cmd --permanent --add-port=30000-31000/tcp
firewall-cmd --reload
如果登录失败或无法上传:
setsebool -P ftp_home_dir on
setsebool -P allow_ftpd_full_access on
ftp localhost
或本地浏览器 / FileZilla 连接服务器 IP。
如果你能提供:
我可以帮你更精准地配置 ✅