温馨提示×

FileZilla Linux版如何免密

小樊
43
2026-08-31 18:23:54
栏目: 智能运维

在 Linux 版 FileZilla 中实现“免密登录”(不输入密码)通常是通过 SSH 密钥认证 来完成的。下面是完整步骤:


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

ssh-keygen -t rsa -b 4096
  • 默认会生成:
    • 私钥:~/.ssh/id_rsa
    • 公钥:~/.ssh/id_rsa.pub
  • 一路回车即可(密码留空 才能实现真正免密)

二、将公钥上传到远程服务器

方法 1:使用 ssh-copy-id(推荐)

ssh-copy-id user@remote_host

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

方法 2:手动复制

cat ~/.ssh/id_rsa.pub

将内容粘贴到服务器的:

~/.ssh/authorized_keys

并确保权限正确:

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

三、在 FileZilla 中配置免密登录

  1. 打开 FileZilla
  2. 站点管理器(Site Manager)
  3. 新建或编辑站点:
    • 协议:SFTP – SSH File Transfer Protocol
    • 主机:服务器 IP
    • 端口:22
    • 登录类型:密钥文件(Key file)
    • 用户:服务器用户名
  4. 密钥文件 中选择:
    ~/.ssh/id_rsa
    
  5. 保存并连接

✅ 此时无需输入密码即可登录


四、常见问题排查

1. FileZilla 提示密钥格式不对

FileZilla 不支持 OpenSSH 新版格式,可转换:

ssh-keygen -p -m PEM -f ~/.ssh/id_rsa

2. 仍然要求密码

检查:

  • 服务器 /etc/ssh/sshd_config
    PubkeyAuthentication yes
    PasswordAuthentication no  # 可后续关闭
    
  • 重启 SSH:
    sudo systemctl restart sshd
    

3. 权限问题

本地私钥权限必须是:

chmod 600 ~/.ssh/id_rsa

五、可选(高级):使用 ssh-agent

eval $(ssh-agent)
ssh-add ~/.ssh/id_rsa

FileZilla 可自动使用 agent(部分版本支持)。


如果你是指 FileZilla Server(Linux 服务端)免密,或者是 FTP(非 SFTP)免密,可以告诉我具体场景,我可以进一步说明。

0