Unable to negotiate with xx.xx.xxx.xx port 22: no matching host key type found.

790 阅读1分钟

ssh链接服务器时,报错如下:

Unable to negotiate with xx.xx.xxx.xx port 22: no matching host key type found. Their offer: ssh-rsa

解决方案: 解决办法是ssh命令指定算法:

ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedKeyTypes=+ssh-rsa  user@host -p 2222

上面比较麻烦, 可以修改ssh配置文件  ~/.ssh/config, 对于无法成功连接的host, 增加配置项:
~/.ssh/config 文件如下:

HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

参考:blog.alanwei.com/blog/2022/0…