亲测可用,决不是简单复制黏贴。SSH Secure Shell Client 登录服务器出现“server responded algorithm negotiation failed”解决方法

#新版linux用SSH Secure Shell Client登录SSH服务时出现“server responded algorithm negotiation failed”解决方法

前两天装了个centos8.3的ftp服务器,装好后用windows的SSH Secure Shell Client登录ssh服务时,提示“server responded algorithm negotiation failed”
错误提示
第一时间百度,查到的方法基本上都是在/etc/ssh/sshd_config 文件末尾添加如下代码:
Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
试了一下,修改配置保存后提示服务无法启动。网上也有人遇到同样的问题,也没有好的解决方法,只好放弃使用SSH Secure Shell Client,改用其他SSH客户端软件,由于对SSH Secure Shell Client的钟爱,我不死心,仔细的研究了一下相关机制,考虑总体原因应该还是老版本的客户端不支持新加密方法,上面方法的思路应该是对的,可能某些细节上出了问题。经过不断尝试,发现上面的有些参数输入进去就无法启动了,有些参数输入进去,也解决不料问题,最后就添加了KexAlgorithms diffie-hellman-group1-sha1这一个参数,其他的保留不变就可以解决问题了。这里要说一下的是centos8.3参数不在/etc/ssh/sshd_config修改,改版本的sshd服务是带参数直接启动的,其启动参数放在/etc/crypto-policies/back-ends/opensshserver.config文件里,如下图找到-oKexAlgorithms
找到-oKexAlgorithms
在这个参数的最后把diffie-hellman-group1-sha1添加进去
在这里插入图片描述
保存文件后,在重启sshd服务就可以连接了。我测试的版本是centos8.3,其他版本未测试,但原理应该差不多,其他版本的很可能是修改/etc/ssh/sshd_config文件,这个具体问题大家具体分析,但原则是参数不要弄太多,否则很容易导致服务无法启动,在系统默认的基础上,在KexAlgorithms后面再添加一个diffie-hellman-group-sha1就可以了。希望能解决你的问题。

Logo

鸿蒙生态一站式服务平台。

更多推荐