FileZilla连接Ubuntu服务器常见故障及解决方法
sudo systemctl status ssh
,若未运行,用sudo systemctl start ssh
启动,并设置开机自启sudo systemctl enable ssh
。/etc/ssh/sshd_config
,确保PermitRootLogin yes
(如需root登录)、PasswordAuthentication yes
(允许密码认证),修改后重启SSH服务sudo systemctl restart ssh
。sudo ufw allow 22/tcp
并启用防火墙sudo ufw enable
。sudo chmod 777 /path/to/directory
临时允许所有用户读写(注意:生产环境建议限制为必要用户,如sudo chown youruser:yourgroup /path/to/directory && sudo chmod 755 /path/to/directory
)。ls -l /path/to/directory
确认所有者,必要时用sudo chown
修改。sudo ufw status
确认是否允许FTP(21)或SFTP(22)端口,未允许则用sudo ufw allow 21/tcp
(FTP)或sudo ufw allow 22/tcp
(SFTP)开放。sudo nano /etc/vsftpd.conf
,确保以下关键参数未被注释且设置正确:local_enable=YES # 允许本地用户登录
write_enable=YES # 允许上传/写入
chroot_local_user=YES # 可选:限制用户只能访问其主目录(增强安全性)
sudo systemctl restart vsftpd
。sudo tail -f /var/log/auth.log
(SSH日志)或sudo tail -f /var/log/vsftpd.log
(vsftpd日志),实时跟踪连接错误原因。