SSH: no matching host key type found.

最近在使用 SSH 连接服务器时有报错:

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

主要原因是服务端较旧,客户端较新,服务端提供的密钥算法在客户端均已经默认被禁用。其中:

这里只能进行一个 workaround,在连接时临时允许特定算法/密钥。

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

如果是 Git 推拉代码的场景,也是同理:

GIT_SSH_COMMAND="ssh -oHostKeyAlgorithms=+ssh-rsa" git clone ssh://user@host/repo

引用

OpenSSH: Legacy Options

web hosting – Unable to negotiate with XX.XXX.XX.XX: no matching host key type found. Their offer: ssh-dss – Stack Overflow

Git error no matching host key type found. Their offer: ssh-rsa – Stack Overflow

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注