在 Linux 下使用 SecureCRT 实现免密登录,本质是使用 SSH 公钥认证。下面给你一套通用、可操作的步骤。
在你要登录的客户端机器(运行 SecureCRT 的 Linux 机器)上执行:
ssh-keygen -t rsa -b 4096
一路回车即可,默认生成:
~/.ssh/id_rsa~/.ssh/id_rsa.pub(如用 ed25519 更推荐:ssh-keygen -t ed25519)
ssh-copy-id user@remote_host
输入一次密码后,后续即可免密。
在本地查看公钥:
cat ~/.ssh/id_rsa.pub
登录远程服务器,写入:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
echo "公钥内容" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
File → Connect → New Session路径(不同版本略有差异):
Connection → SSH2 → Authentication
Properties~/.ssh/id_rsaSecureCRT 支持 OpenSSH 格式私钥(新版),老版本如需转换:
ssh-keygen -p -m RFC4716 -f ~/.ssh/id_rsa
直接双击 Session:
Connecting to ...
Authenticated.
✅ 无需输入密码即成功
检查服务器:
ls -ld ~ ~/.ssh ~/.ssh/authorized_keys
权限应为:
~:755 或更严格~/.ssh:700authorized_keys:600restorecon -Rv ~/.ssh
grep PubkeyAuthentication /etc/ssh/sshd_config
应为:
PubkeyAuthentication yes
修改后重启:
systemctl restart sshd
ssh-agent 管理密钥PasswordAuthentication no
如果你愿意,可以告诉我:
我可以给你更精确的截图级配置说明。