发新帖

[Mac] Mac电脑远程服务器时提示:Unable to negotiate with no matching host key type found. Their offer: ssh-rsa,ssh-dss

零下一度 1月前 51

解决方法

方法 1:临时指定接受的密钥类型(推荐)

在 SSH 命令中显式允许 ssh-rsa 或 ssh-dss(根据服务器支持的算法):

ssh -o HostKeyAlgorithms=ssh-rsa username@server_ip

或同时允许两种算法:

ssh -o HostKeyAlgorithms=ssh-rsa,ssh-dss username@server_ip

方法 2:修改 SSH 客户端配置(永久生效)

编辑 ~/.ssh/config 文件,添加以下内容:

Host *
    HostKeyAlgorithms ssh-rsa,ssh-dss

保存后,后续所有连接都会尝试这些算法。

方法 3:降级 OpenSSH 安全性(不推荐)

如果服务器仅支持非常旧的算法(如 ssh-dss),可以强制允许:

ssh -o PubkeyAcceptedKeyTypes=+ssh-dss username@server_ip

原因说明

服务器端:可能运行的是较旧的 SSH 服务(如 OpenSSH 6.x 或更早),仅支持 ssh-rsa 或 ssh-dss。

客户端(Mac):新版 OpenSSH(>= 8.8)默认禁用 ssh-rsa(SHA-1 哈希不安全)和 ssh-dss(DSA 已淘汰)。





最新回复 (0)
返回
零下一度
主题数
940
帖子数
0
注册排名
1