解决因本地ssh版本过高导致连接失败问题
Bash
-bash-4.1$ ssh 192.168.1.2
Unable to negotiate with 192.168.1.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group14-sha1
-bash-4.1$ ssh -V
OpenSSH_8.3p1, OpenSSL 1.1.1g 21 Apr 2020
以上为错误输出,此问题由于本地SSH版本过高,且对端版本过低导致,使得加密方式无法匹配。
在~/.ssh目录下创建以下文件,并授权:
Bash
-bash-4.1$ cat ~/.ssh/config
host *
KexAlgorithms +diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
-bash-4.1$ chmod 600 ~/.ssh/config
测试连接,密码正常回显
Bash
-bash-4.1$ ssh 192.168.1.2
192.168.1.2's password:
发表评论