openssh 添加 sha1支持

openssh 添加 sha1支持

ubuntu 20.04 默认的 openssh 版本8.2p1不再支持老的hash加密算法。连接网络设备时报错。会有相关的报错。配置ssh以支持老的hash加密算法,实现对设备的远程连接。

提示如下:

Unable to negotiate with 10.10.100.253 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1

diffine-hellman

解决办法

  • 方法一
1
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@legacyhost

如上面示例设备提供的加密算法为diffie-hellman-group14-sha1
连接时实际使用:

1
ssh -oKexAlgorithms=+diffie-hellman-group14-sha1 admin@10.10.100.253
  • 方法二

编辑家目录下的配置文件(~/.ssh/config)

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

追加到config文件后面,即可。

其它的算法支持,参考openssh官方文档


openssh 添加 sha1支持
https://ywmy.xyz/2021/01/29/openssh-添加-sha1支持/
作者
ian
发布于
2021年1月29日
许可协议