当我尝试通过 ssh 连接到我的一个交换机时,出现以下错误:
$ ssh remotehost
Unable to negotiate with 1.2.3.4 port 22: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1
Run Code Online (Sandbox Code Playgroud)
如果我列出可用的密钥交换算法,我可以看到我们确实拥有它;
$ ssh -Q kex
...
...
diffie-hellman-group14-sha1
...
Run Code Online (Sandbox Code Playgroud)
手动将其指定为选项确实有效,并为它创建一个 .ssh/config 条目,但如果它在 kex 列表中,不应该自动选择它吗?
ssh -o KexAlgorithms=diffie-hellman-group14-sha1 user@remotehost
Run Code Online (Sandbox Code Playgroud)
.ssh/配置
Host remotehost
KexAlgorithms +diffie-hellman-group14-sha1
Run Code Online (Sandbox Code Playgroud)