错误现象

ssh root@192.168.5.245

Unable to negotiate with 192.168.5.245 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,kexguess2@matt.ucc.asn.au

解决办法

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@192.168.5.245

root@192.168.5.245's password:

要是觉得-o后面这一堆参数很难记的话, 有个简单的办法,其实这部分内容就在错误提示信息里面了,从错误信息里面复制就好了.
-oKexAlgorithms=+diffie-hellman-group1-sha1
KexAlgorithms就是指交换秘钥算法的意思.
另一个解决办法

su
echo "KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1" >>/etc/ssh/ssh_config.d/weak.conf

cat /etc/ssh/ssh_config.d/weak.conf

KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1

有加就有减,不支持diffie-hellman-group-exchange-sha1的就使用

ssh -oKexAlgorithms-=diffie-hellman-group-exchange-sha1 
本文链接地址:https://const.net.cn/704.html

标签: ssh

添加新评论