关于no matching key exchange method found. Their offer: 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.
Thanks for reading!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!