Unable to negotiate with ... port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss
起因
MAC 在升级 Ventura(13.2)版本后进行ssh
连接服务器时提示密钥类型不正确, 搜索后是因为OpenSSH版本禁用了ssh-dss
解决方案
- 方案一
ssh -oHostKeyAlgorithms=+ssh-dss user@10.10.134.56
- 方案二
vim ~/.ssh/config
Host *
PubkeyAcceptedKeyTypes +ssh-dss
HostKeyAlgorithms +ssh-dss
如果遇见不同的算法类型不匹配,根据报错所提示的算法类型对两个方案算法进行修改即可
参考
- https://www.openssh.com/legacy.html
- https://askubuntu.com/questions/836048/ssh-returns-no-matching-host-key-type-found-their-offer-ssh-dss
- https://www.ibm.com/docs/en/zos/2.5.0?topic=4-dsa-ssh-dss-key-support