ssh 客户端登陆缺少私钥交换方法 no matching key exchange method found.

699 阅读1分钟

Unable to negotiate with port : no matching key exchange method found. Their offer: diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

WARNING: OpenSSH has disabled these algorithms by default because they are known to be weak. The best resolution for this failure would be to upgrade the SSH server and/or replace the weak key types with safer modern types. This might not be immediately possible, so you may need to temporarily re-enable the weak algorithms to retain access.

You can do so by using the -legacy command-line parameter: ┌─────────────────────────────┐ │  ssh -legacy user@host │ └─────────────────────────────┘

If you have a persistent HOME directory, you can also edit the following file: ┌─────────────────┐ │ ~/.ssh/config │ │ └──────────────────────────────────────────────────────┐ │Host * │ │ KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1 │ │ HostKeyAlgorithms +ssh-rsa,ssh-dss │ └────────────────────────────────────────────────────────────────────────┘

image.png

$ cat ~/.ssh/config
Host *
  KexAlgorithms +diffie-hellman-group1-sha1,diffie-hellman-group14-sha1
  HostKeyAlgorithms +ssh-rsa,ssh-dss