Ubuntu上FileZilla无法连接的解决方法
首先确保客户端与Ubuntu服务器之间的网络可达。在客户端终端执行ping <服务器IP地址>,若显示“请求超时”,则需排查网络配置(如路由器、防火墙或服务器IP是否正确)。
sudo systemctl status ssh,若未运行,用sudo systemctl start ssh启动,并通过sudo systemctl enable ssh设置开机自启。sudo apt-get install vsftpd安装,然后启动服务sudo systemctl start vsftpd并设置开机自启sudo systemctl enable vsftpd。Ubuntu默认使用ufw防火墙,需开放对应端口:
sudo ufw allow 22/tcpsudo ufw allow 21/tcp
执行sudo ufw enable启用防火墙,再用sudo ufw status确认规则已添加。打开FileZilla,进入“站点管理器”(编辑→站点管理器):
若使用vsftpd,需修改配置文件/etc/vsftpd.conf:
#前缀):local_enable=YES # 允许本地用户登录
write_enable=YES # 允许上传/修改文件
chroot_local_user=YES # 限制用户到自家目录(可选,增强安全性)
sudo systemctl restart vsftpd。若使用SFTP,需确保SSH允许密码认证:
/etc/ssh/sshd_config,修改以下参数:PasswordAuthentication yes # 允许密码登录
PermitRootLogin yes # 允许root登录(可选,根据需求设置)
sudo systemctl restart ssh。sudo tail -f /var/log/auth.log;FTP日志查看sudo tail -f /var/log/vsftpd.log,获取更详细的错误信息。ssh <用户名>@<服务器IP>,若能登录则说明SSH服务正常。telnet <服务器IP> 21(FTP)或telnet <服务器IP> 22(SFTP),若显示“Connected”则表示端口可达。