ssh 登录报错 no matching host key type found
cmd> ssh root@1.1.1.1
cmd> Unable to negotiate with 1.1.1.1 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
该错误表明服务器仅支持旧版的 ssh-rsa 和 ssh-dss 主机密钥算法,而你的 SSH 客户端默认可能不再支持这些算法。新的 OpenSSH 客户端默认禁用了过时或不安全的加密算法。
- 添加支持 ssh-rsa 的选项
ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa root@1.1.1.1
本地的 SSH 配置文件中,显式启用支持旧算法:
~/.ssh/config,添加以下内容:
Host 1.1.1.1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
本作品采用《CC 协议》,转载必须注明作者和本文链接