在 Ubuntu 上使用 SecureCRT 配置 密钥登录(SSH 公钥认证),一般流程如下:
在终端执行:
ssh-keygen -t rsa -b 4096
或(更推荐)
ssh-keygen -t ed25519
一路回车即可,默认生成:
~/.ssh/id_rsa 或 id_ed25519~/.ssh/id_rsa.pub 或 id_ed25519.pub(如设置了 passphrase,登录时需要输入)
ssh-copy-id user@server_ip
cat ~/.ssh/id_rsa.pub
把内容粘贴到服务器的:
~/.ssh/authorized_keys
并设置权限:
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
SecureCRT 不能直接用 OpenSSH 私钥(旧版),需要转换:
ssh-keygen -p -m PEM -f ~/.ssh/id_rsa
然后在 SecureCRT:
~/.ssh/id_rsa.key 文件把 .pub 内容加到服务器 authorized_keys
直接双击 Session,若配置正确:
✅ 权限错误(服务器)
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
✅ SecureCRT 不支持新格式 RSA → 用 PEM 格式转换
✅ Ubuntu 22.04+ 默认禁止 SHA-1
→ 用 ed25519
如果你愿意,可以告诉我:
我可以给你更精确的步骤。