升级后的 Ubuntu - ssh 交换失败

use*_*336 4 server ssh 16.04

将 Ubuntu 从 14.04 升级到 16.04 后,我遇到了一些问题。我尝试通过 SSH 与某些服务器建立 SSH 连接,但在某些情况下升级后,我有以下输出:

Unable to negotiate with 10.13.45.221 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1
Run Code Online (Sandbox Code Playgroud)

我知道添加这个: ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@legacyhost

但也许是另一种全局启用它并像 14.04 一样仅使用 ssh user@host 的方法?

hee*_*ayl 5

这意味着diffie-hellman-group1-sha1在默认的密钥交换算法集中不存在。

ssh永久使用该选项,请将以下内容添加到您的~/.ssh/config(或全局/etc/ssh/ssh_config):

KexAlgorithms=+diffie-hellman-group1-sha1
Run Code Online (Sandbox Code Playgroud)

如果您希望在全局范围内添加指令Host,请注意, Matchetc 选择性声明,因为这些片段中的值仅适用于提到的集合。不确定时,将其放在顶部。