ssh无法访问服务器报“ssh-dss”认证错误

时间:2023-03-09 08:54:57
ssh无法访问服务器报“ssh-dss”认证错误

故障描述:

在windows下的ssh客户端直接报错,内容为:

Unable to negotiate with legacyhost: no matching host key type found. Their offer: ssh-dss

在Linux下不报错,连不上服务器。打开ssh的verbose输出模式,可以看到最后一行输出也是ssh-dss的故障:

ssh无法访问服务器报“ssh-dss”认证错误

参考open-ssh的官方文档原因是新版本的SSH禁用了ssh-dss(DSA)公钥算法,DSA算法太脆弱不推荐使用。如果要重新激活,可以在命令行参数中指明:

ssh -oHostKeyAlgorithms=+ssh-dss user@legacyhost

或者在配置文件 ~/.ssh/config 中设置:

Host somehost.example.org
HostKeyAlgorithms +ssh-dss