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

问题描述:

在使用命令 ssh -p 8101 karaf@localhost 远程连接服务器时出现

Unable to negotiate with localhost port 8101: no matching host key type found. Their offer: ssh-rsa

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

解决办法1:使用ssh命令时指定算法

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

解决办法2:修改ssh配置文件 ~/.ssh/config,对于无法成功连接的host, 增加配置项:

Host xxxx.com
  HostName xxxx.com
  User xxx
  Port 22
  HostKeyAlgorithms +ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-rsa

或者对所有host指定:

Host *
  ServerAliveInterval 10
  HostKeyAlgorithms +ssh-rsa
  PubkeyAcceptedKeyTypes +ssh-rsa

参考链接:解决SSH no matching host key type found 问题 - Alan's Blog

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>