问题出现在了ubuntu22.04 和 Debain12 上,在使用 Xshell 密钥连接服务器时候出现了错误

通过执行命令

1
sudo sshd -T | egrep "pubkey"

可以看到

1
2
3
pubkeyauthentication yes
pubkeyacceptedalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
pubkeyauthoptions none

openssh 已经不再支持 ssh-rsa 的方式登录,既然都不支持了,那就换个受支持的密钥类型吧

以 Xshell 为例

将新生成的公钥替换之前的公钥即可。