宁睿 发表于 2024-11-30 12:13:55

【已办理】远程连接服务器报错,no matching host key type found. Their o

题目形貌

用VS Code连接远程服务器时,出现无法与“服务器”建立连接的错误,如下图。
https://i-blog.csdnimg.cn/direct/b4188a01a69e424eb445f15153fa2df6.png
办理过程

Step 1

查看输出的报错信息:
> Unable to negotiate with xxx.xxx.xxx.xxx port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
> 过程试图写入的管道不存在。
搜索报错信息,参考了链接1CSDN 和 链接2知乎,在配置文件~/.ssh/config中相应的地方加上以下两条命令。
Host xxx
    HostName xxx.xxx.xxx.xxx
    User xxx
    Port xx
    HostKeyAlgorithms = +ssh-rsa# 添加
    PubkeyAcceptedAlgorithms = +ssh-rsa # 添加
在加上两条语句后,仍然连接失败,报了差别的错误。
Step 2

报错信息:
> Unable to negotiate with 10.212.43.35 port 10086: no matching MAC found. Their offer: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
> 过程试图写入的管道不存在。
搜索报错信息,参考了链接3腾讯云小微和另一位朋友的指点。终极在配置文件中添加最后一条语句:
Host xxx
    HostName xxx.xxx.xxx.xxx
    User xxx
    Port xx
    HostKeyAlgorithms = +ssh-rsa# 添加
    PubkeyAcceptedAlgorithms = +ssh-rsa # 添加
    MACs hmac-sha1 # 添加 连接成功!
原因分析:

根据链接2知乎的解释,Step 1 中的报错是由于
   openssh觉得ssh-rsa加密方式不安全, 直接从8.8开始默认不允许这种密钥用于登岸了。
根据链接3腾讯云小微中某答主的形貌,Step 2中的错误是因为:
   造成此错误的根本原因是在源计算机上,受支持的MAC不包含来自目标服务器的MAC。
    因此,为了连接到目标服务器,选择您的服务器不支持的mac,您必须显式地提供目标服务器支持的mac之一。

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: 【已办理】远程连接服务器报错,no matching host key type found. Their o