Frost_ZX
Frost_ZX
Published on 2024-11-13 / 5 Visits
0
0

SSH 登录时提示“no matching host key type found”

当前现象

通过 SSH 登录服务器时出现以下提示:

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

解决方法

方法一:添加参数

在 ssh 命令中添加参数,指定算法,例如:

ssh root@192.168.1.1 -o HostKeyAlgorithms=+ssh-rsa,ssh-dss -o PubkeyAcceptedKeyTypes=+ssh-rsa,ssh-dss

方法二:修改配置文件

修改 SSH 客户端配置文件 ~/.ssh/config ,添加内容:

# 对全部服务器生效
HostKeyAlgorithms +ssh-rsa,ssh-dss
PubkeyAcceptedKeyTypes +ssh-rsa,ssh-dss
# 对指定的服务器生效
Host ExampleServer
  HostName 192.168.1.1
  Port 22
  User root
  HostKeyAlgorithms +ssh-rsa,ssh-dss
  PubkeyAcceptedKeyTypes +ssh-rsa,ssh-dss

参考信息


Comment