Unable to negotiate with xxxxport 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

操作环境:Kali Linux

终端远程登录ssh时,提示如下错误:

Unable to negotiate with 192.168.1.152 port 22: nomatching host host key type found. Their offer:ssh-dss
由提示得知,ssh不能远程登录的原因为:没有找到相关的主机密钥类型。

1、确实是主机密钥类型不符合

2、不存在相关主机密钥类型

生成ssh_key

1
ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_keyssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
重启ssh之后远程,问题依然存在

确认密钥已存在…

网络搜索中…

指定主机key算法(最后解决方案):

1、命令中加参数

1
ssh -o HostKeyAlgorithms=+ssh-dss user@host

方法一:执行 ssh 指令时增加参数

ssh -oHostKeyAlgorithms=+ssh-dss user@legacyhost
user@legacyhost 替换成自己的服务器登录名及登录地址

2、在~/.ssh目录下添加config

1
vi config
  在config中写入以下code:

1
2
Host *
HostKeyAlgorithms +ssh-dss
3、重启ssh

1
service ssh restart

Login success !!!

猜你喜欢

转载自blog.csdn.net/weixin_43214644/article/details/126505589