no matching host key type found. Their offer: ssh-rsa 问题解决

最近升级了Mac OS Ventura 13.0.1后发现ssh指定密钥登录服务器失败。

no matching host key type found. Their offer: ssh-rsa

进入当前用户的.ssh目录发现比之前系统多了一个config文件

查看sshd版本,发现升级了,需要指定算法参数

解决办法:

方法1. ssh命令指定算法,每次指定比较麻烦

ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa  user@host -p 2222
方法2. 修改ssh配置文件 ~/.ssh/config, 增加配置项,一劳永逸

HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

上面配置默认对所有连接的服务器生效,也可以通过制定服务器使部分服务器生效

Host 172.16.x.x
HostName k8s-node001
User root
Port 22
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
为什么会有这个错误
Future deprecation notice It is now possible[1] to perform chosen-prefix attacks against the SHA-1 algorithm for less than USD$50K.

In the SSH protocol, the “ssh-rsa” signature scheme uses the SHA-1 hash algorithm in conjunction with the RSA public key algorithm. OpenSSH will disable this signature scheme by default in the near future.

Note that the deactivation of “ssh-rsa” signatures does not necessarily require cessation of use for RSA keys. In the SSH protocol, keys may be capable of signing using multiple algorithms. In particular, “ssh-rsa” keys are capable of signing using “rsa-sha2-256” (RSA/SHA256), “rsa-sha2-512” (RSA/SHA512) and “ssh-rsa” (RSA/SHA1). Only the last of these is being turned off by default.

也就是说 >=8.8p1 版的 openssh 的 ssh 客户端默认禁用了 ssh-rsa 算法, 但是服务器端未升级只支持 ssh-rsa, 当你不能自己升级远程服务器的 openssh 版本或修改配置让它使用更安全的算法时, 在本地 ssh 针对这些旧的ssh server重新启用 ssh-rsa 也是一种权宜之法.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
该错误表示在SSH连接中,无法匹配到适配的主机密钥类型。对于提供的主机密钥类型为ssh-rsa时发生了不匹配的情况。 为了解决这个问题,可以按照以下步骤操作: 1. 找到本地的SSH目录,通常位于C:\Users\用户名\.ssh。 2. 检查是否存在config文件,如果不存在,则创建一个config文件。 3. 在config文件中添加以下配置: Host * HostkeyAlgorithms ssh-rsa PubkeyAcceptedKeyTypes ssh-rsa 4. 保存并关闭config文件。 5. 尝试再次使用git clone命令克隆代码。 这样,你应该能够成功克隆代码了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [.ssh目录中config配置文件](https://download.csdn.net/download/gongjin28_csdn/85413492)[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: 33.333333333333336%"] - *2* [Unable to negotiate with 100.12.0.7 port 22: no matching host key type found. Their offer: ssh-rsa](https://blog.csdn.net/qiuyu1998/article/details/124726695)[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: 33.333333333333336%"] - *3* [解决no matching host key type found. Their offer: ssh-rsa报错信息具体方法](https://blog.csdn.net/weixin_43636782/article/details/123416064)[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: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值