在 Debian 上“重置 FTP 服务器”通常指重置配置、用户或密码,或重装服务。下面按常见场景说明,以 vsftpd(Debian 默认常用 FTP 服务)为例。
如果你改坏了配置:
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak
sudo apt-get install --reinstall vsftpd
或手动恢复默认配置:
sudo mv /etc/vsftpd.conf /etc/vsftpd.conf.old
sudo dpkg-reconfigure vsftpd
重启服务:
sudo systemctl restart vsftpd
FTP 通常使用的是系统用户:
sudo passwd ftpuser
如果是虚拟用户(如 PAM + db4),需重置对应虚拟用户数据库。
sudo deluser ftpuser
sudo adduser ftpuser
sudo usermod -aG ftp ftpuser
sudo systemctl stop vsftpd
sudo apt-get purge vsftpd
sudo rm -rf /etc/vsftpd*
sudo apt-get install vsftpd
sudo systemctl enable --now vsftpd
确保 21 端口开放:
sudo ufw allow 21/tcp
如使用被动模式,还需:
sudo ufw allow 30000:31000/tcp
并在 vsftpd.conf 中配置:
pasv_min_port=30000
pasv_max_port=31000
sudo dpkg-reconfigure proftpd-basic
sudo apt-get purge pure-ftpd
sudo apt-get install pure-ftpd
如果你能说明:
我可以给你更精确的步骤。