【linux】SSH 连接失败: no matching host key type found. Their offer: ssh-rs

root:~ >ssh root@192.168.33.133
Unable to negotiate with 192.168.33.133 port 22: no matching host key type found. Their offer: ssh-rsa

这个问题经常出现在ssh 服务端版本和客户端版本不匹配。

要解决问题,需要在命令加上一个选项: -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa

比如:

ssh -i key.pem shell@3.252.167.165 -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa

也可以加参数加到 ssh config file, /etc/ssh/ssh_config :

HostKeyAlgorithms = +ssh-rsa
PubkeyAcceptedAlgorithms = +ssh-rsa

另一个选择是在创建密钥对时使用不同的算法。

要查看 Linux 系统上 SSH 命令支持的算法,可以使用 ssh -Q 命令。具体来说,可以使用以下命令来查看支持的加密算法、散列算法和公钥算法:

ssh -Q cipher # 查看支持的加密算法 
ssh -Q mac # 查看支持的散列算法 
ssh -Q key # 查看支持的公钥算法

.

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
"Unable to negotiate with 10.128.0.0 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss" 这个错误表示终端无法与目标主机建立SSH连接,因为没有找到匹配的主机密钥类型。在新版的OpenSSH中,默认不再支持使用SHA1这种较弱的散列算法。要解决这个问题,我们需要手动允许对于SHA1的支持。 为了解决这个问题,您可以尝试以下步骤: 1. 在终端中使用以下命令连接到目标主机: ssh -oHostKeyAlgorithms=+ssh-rsa -oKexAlgorithms=+diffie-hellman-group1-sha1 user@10.128.0.0 这将允许使用ssh-rsa主机密钥类型和diffie-hellman-group1-sha1密钥交换方法进行连接。 2. 如果第一步无效,您可以尝试在SSH配置文件中进行更改。打开SSH配置文件(通常位于/etc/ssh/或~/.ssh/目录下的ssh_config文件),找到HostKeyAlgorithms和KexAlgorithms这两个选项,将它们的值分别改为: HostKeyAlgorithms +ssh-rsa KexAlgorithms +diffie-hellman-group1-sha1 3. 保存并关闭配置文件,然后尝试重新连接到目标主机。 通过以上步骤,您应该能够解决"Unable to negotiate with 10.128.0.0 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss"的问题。记得在连接之前备份配置文件,以便在需要时进行恢复。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Unable to negotiate with 172.16.28.137 port 22: no matching host key type found. Their offer: ssh-rs](https://blog.csdn.net/wuliuqi_567/article/details/128103215)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [Unable to negotiate with 192.168.2.53 port 22: no matching host key type found. Their offer: ssh-rsa](https://blog.csdn.net/weixin_43025071/article/details/128241732)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值