从 Ubuntu 18.04 升级到 20.04 后,Putty SSH 客户端密钥交换失败

从 Ubuntu 18.04 升级到 20.04 后,Putty SSH 客户端密钥交换失败

从 Ubuntu 18.04 升级到 Ubuntu 20.04 后,我无法使用 Putty 0.62 连接到我的 Ubuntu 服务器。PuTTY 致命错误:

Couldn't agree a key exchange algorithm (available: curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffe-hellman-group16sha512,diffie-hellman-group18,sha512,diffie-hellman-group14-sha256)

/var/log/auth.log 中的匹配消息是:

sshd[5210]: Unable to negotiate with 192.168.1.20 port 533 07: no matching key exchange method found. Their offer: diffie-hellman-group-exc hange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diff ie-hellman-group1-sha1,rsa2048-sha256,rsa1024-sha1 [preauth]

答案1

四处搜索后,我发现了一篇帖子,声称“在发现一些针对 SHA1 的攻击后,Ubuntu 20.04 已禁用基于 SHA1 的密钥交换方法。”Ubuntu 的直接 ssh 命令可以通过重新启用 diffie-hellman-group1-sha1 来解决这个问题。一篇专门针对 Putty 的帖子建议将 diffie-hellman 选项推到 PuTTY 的连接 > SSH > Kex 首选项列表的底部,但这只会让我使用 RSA,而 RSA 似乎也被拒绝了。

对我来说,解决方法是从 PuTTY 0.62 升级到 0.76。这会将 ECDH 密钥交换添加到 PuTTY 列表的顶部,并且 ssh 到 Ubuntu 20.04 服务器就可以正常工作了。

相关内容