在Debian系统下,要让vsftpd服务在启动时自动运行,可以使用systemd来管理。以下是创建一个自动启动脚本的步骤:
sudo apt-get update
sudo apt-get install vsftpd
vsftpd.service的新文件:sudo nano /etc/systemd/system/vsftpd.service
[Unit]
Description=vsftpd FTP Server
After=network.target
[Service]
Type=simple
User=ftp
Group=ftp
ExecStart=/usr/sbin/vsftpd /etc/vsftpd.conf
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
[Install]
WantedBy=multi-user.target
这个服务文件定义了一个名为vsftpd的服务,它在网络启动后运行,并在失败时自动重启。
保存并关闭文件。
重新加载systemd配置以识别新创建的服务:
sudo systemctl daemon-reload
sudo systemctl enable vsftpd.service
sudo systemctl start vsftpd.service
sudo systemctl status vsftpd.service
现在,vsftpd服务应该已经在Debian系统上配置为自动启动了。