温馨提示×

debian filezilla如何免密登录

小樊
53
2026-09-07 19:38:08
栏目: 智能运维

在 Debian 上使用 FileZilla 免密登录(密钥登录) 通常是通过 SSH 密钥对 来实现的,而不是用密码。下面一步步说明。


一、在 Debian 本地生成 SSH 密钥(如果还没有)

打开终端:

ssh-keygen -t rsa -b 4096

一路回车即可(默认生成在 ~/.ssh/id_rsa 和 ~/.ssh/id_rsa.pub)。


二、把公钥上传到服务器

方法 1:使用 ssh-copy-id(最简单)

ssh-copy-id user@server_ip

输入一次密码后,以后就可以免密登录。


方法 2:手动复制公钥

在本地查看公钥:

cat ~/.ssh/id_rsa.pub

登录服务器后,编辑:

nano ~/.ssh/authorized_keys

把公钥粘贴进去,保存。

确保权限正确:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

三、FileZilla 配置密钥登录

1. 打开 FileZilla

  • 站点管理器(File → Site Manager)

2. 新建站点

  • 协议:SFTP – SSH File Transfer Protocol
  • 主机:服务器 IP
  • 端口:22(默认)
  • 登录类型:密钥文件(Key file)

3. 用户 & 密钥

  • 用户:服务器用户名
  • 密钥文件:选择
    /home/你的用户/.ssh/id_rsa
    

⚠️ 如果是 Windows 版 FileZilla,需要把私钥转换为 PPK(用 PuTTYgen)


四、测试连接

点击「连接」,如果配置正确,就不会再提示输入密码。


五、常见问题

1. 服务器禁止密钥登录

编辑服务器上的:

sudo nano /etc/ssh/sshd_config

确保:

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

重启 SSH:

sudo systemctl restart ssh

2. 只想 FileZilla 免密,SSH 仍要密码

✅ 可以,只配置 FileZilla 用密钥即可,不影响终端登录方式。


3. Debian 上 FileZilla 找不到密钥

确认:

  • 私钥权限是 600
  • 路径正确
  • 不是只放了公钥

如果你告诉我:

  • 是 Debian 客户端还是服务器
  • FileZilla 是 Linux 还是 Windows

我可以给你更精确的步骤。

0 踩