关于no matching key exchange method found. Their offer: diffie-hellman-group1-sha1的解决办法

解决OpenSSH7连接失败问题
本文详细解释了OpenSSH7.0连接失败的原因,由于diffie-hellman-group1-sha1算法被认为存在安全风险,导致客户端与服务器无法协商一致的密钥交换算法。文章提供了两种解决方案,一是升级服务器配置避免使用过时算法,二是临时在客户端重新启用该算法。

原文链接:https://mycyberuniverse.com/error/no-matching-key-exchange-method-found-openssh7.html

What causes this problem

OpenSSH 7.0 deprecated the diffie-hellman-group1-sha1 key algorithm because it is weak and within theoretical range of the so-called Logjam attack. See the www.openssh.com/legacy.html page for more information.

If the client and server are unable to agree on a mutual set of parameters then the connection will fail. OpenSSH (7.0 and greater) will produce an error message like this:

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

In this case, the client and server were unable to agree on the key exchange algorithm because the server offered only a single method diffie-hellman-group1-sha1.

How to fix it

The best resolution for these failures is to upgrade/configure the server to not use deprecated algorithms. If that is not possible, you can force the client to re-enable the diffie-hellman-group1-sha1 key exchange algorithm with the -oKexAlgorithms=+diffie-hellman-group1-sha1 option on the command-line:

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@host

or in the ~/.ssh/config file:

Host somehost.example.org
    KexAlgorithms +diffie-hellman-group1-sha1

注意:这里的两行代码分开写,另外Host后面的网址不要用IP地址代替(如果dns无法解析就在hosts文件中添加即可)

If this article helped you solve the problem then please leave a comment. :smiley:

Thanks for reading!

转载于:https://www.cnblogs.com/feipeng8848/p/9523416.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值