温馨提示×

centos ftpserver如何自动启动

小樊
41
2026-09-09 01:41:37
栏目: 智能运维

在 CentOS 上让 FTP 服务器(如 vsftpd)开机自动启动,通常有以下几种方式,取决于你使用的 CentOS 版本(6 还是 7+)。


一、确认 FTP 服务类型

最常见的是 vsftpd:

rpm -qa | grep vsftpd

如果没安装:

yum install vsftpd -y

二、CentOS 7 / 8 / Stream(systemd)

1️⃣ 设置开机自启

systemctl enable vsftpd

2️⃣ 启动服务

systemctl start vsftpd

3️⃣ 查看状态

systemctl status vsftpd

✅ 输出中有 enabled 表示已设置自动启动。


三、CentOS 6(SysV init)

chkconfig vsftpd on
service vsftpd start

查看:

chkconfig --list vsftpd

四、其他 FTP 服务(proftpd / pure-ftpd)

proftpd

systemctl enable proftpd
systemctl start proftpd

pure-ftpd

systemctl enable pure-ftpd
systemctl start pure-ftpd

五、常见问题排查

1️⃣ 防火墙未放行 FTP

firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload

2️⃣ SELinux 导致无法连接

临时测试:

setenforce 0

永久允许 FTP:

setsebool -P ftpd_full_access on

3️⃣ 确认监听端口

netstat -tunlp | grep ftp

六、总结(推荐做法)

✅ CentOS 7+ 标准方式

systemctl enable --now vsftpd

如果你用的是 特定 FTP 软件 或 CentOS 具体版本,可以告诉我,我可以给你更精确的配置。

0 踩