远方有多远,请你告诉我!

mac升级Ventura后ssh提示密钥类型不匹配

Posted on By 赵赵赵小白

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