温馨提示×

FileZilla连不上Debian怎么办

小樊
34
2026-08-14 16:58:47
栏目: 智能运维

FileZilla 连不上 Debian 一般不是单一原因,可以按下面顺序一步步排查(从最常见到较少见)。我先给你一个快速检查清单,再展开每一步怎么做。


一、先确认 3 个最基本的问题

在 Debian 上执行:

ip a
sudo systemctl status ssh
sudo ss -lntp | grep :22

重点看:

  • Debian 是否有 IP 地址
  • ssh 服务是否 active (running)
  • 是否监听 22 端口

如果这三项有问题,FileZilla 一定连不上。


二、最常见原因 & 解决方法

✅ 1. SSH 服务没开(最常见)

Debian 默认可能没装或没启动 SSH。

sudo apt update
sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh

✅ 2. 防火墙拦截(非常常见)

Debian 默认可能用 ufwnftables

UFW

sudo ufw status
sudo ufw allow 22
sudo ufw reload

nftables / iptables

sudo iptables -L -n

如果看到 DROP / REJECT 22,需要放行。


✅ 3. FileZilla 协议选错(很多人踩坑)

FileZilla 不是 FTP,而是 SFTP

在 FileZilla 中:

  • 协议:SFTP - SSH File Transfer Protocol
  • 主机:Debian IP
  • 端口:22
  • 用户/密码:Debian 用户

❌ 不要选 FTP
❌ 不要填 21 端口


✅ 4. Debian 是虚拟机(桥接 / NAT 问题)

如果你用 VirtualBox / VMware:

  • 桥接模式:Debian 和主机在同一网段
  • NAT 模式:需要端口转发

VirtualBox NAT 示例

设置 → 网络 → 高级 → 端口转发

主机端口:2222
子系统端口:22

FileZilla 连接:

主机:127.0.0.1
端口:2222

✅ 5. SSH 配置禁止 root 登录

如果你用 root 登录失败:

sudo nano /etc/ssh/sshd_config

确认:

PermitRootLogin yes
PasswordAuthentication yes

然后:

sudo systemctl restart ssh

⚠ 生产环境不建议 root 直接登录


✅ 6. Debian 没有设置密码

passwd 用户名

三、FileZilla 报错对照表

FileZilla 提示 原因
连接超时 IP 不通 / 防火墙
无法连接到服务器 SSH 没开
认证失败 用户名/密码错
服务器返回错误 协议选错
ECONNREFUSED Debian 没监听 22

四、快速自检命令(复制粘贴即可)

ping 你的DebianIP
ssh 用户名@DebianIP

如果 ssh 能连,FileZilla 一定能连


五、如果你愿意,我可以直接帮你定位

你可以直接把下面信息发我(不用全发,发一部分也行):

  1. Debian 是 实体机 / 虚拟机 / 云服务器
  2. FileZilla 的 完整报错信息
  3. Debian 执行:
    ip a
    sudo systemctl status ssh
    

我可以一步一步帮你精确到“哪一行配置错了”。

0