在 Debian(作为 SSH 服务端) 上使用 SecureCRT(客户端) 配置 密钥登录(公钥认证),一般步骤如下:
Tools → Create Public Key2048 或 4096Identity 或 xxx.pub 对应私钥xxx.pubSecureCRT 默认生成的是 OpenSSH 格式或 SecureCRT 格式 Debian 一般用 OpenSSH 格式
ssh user@debian_ip
.ssh 目录(如果不存在)mkdir -p ~/.ssh
chmod 700 ~/.ssh
将 SecureCRT 生成的 .pub 文件内容粘贴到:
nano ~/.ssh/authorized_keys
或上传后:
cat id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
Connection → SSH2Authentication:
Properties → 选择私钥文件(Identity 或 .pub 对应的私钥)编辑:
sudo nano /etc/ssh/sshd_config
确保以下配置:
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no # 可选,禁用密码
重启 SSH:
sudo systemctl restart ssh
sudo tail -f /var/log/auth.log
.ssh 不能是 777authorized_keys 不能是 664~/.ssh/
├── authorized_keys
└── (server side only)
如果你愿意,我可以:
告诉我你的 SecureCRT 版本和 Debian 版本即可。