解决SSH no matching host key type found

  • 97
  • 0
  • 2023-07-13

近期使用WSL+SSH發現無法正確連線,因此在系統端做了某些設定後,解決問題。

首先,去設定SSH這一段的設定,預設路徑在 /etc/ssh/內,閱讀了ssh_config後,發現寫入在ssh_config.d的資料夾內會是比較好的方法,避免每次連線寫一堆落落長。

會造成此一原因,係新版本的SSH關閉了舊版的加密連線方式,添加設定後強制它回歸舊版。

因此,我建立一個設定檔 ssh_config.conf (結尾一定是要conf) 在ssh_config.d資料夾內,內容如下:

KexAlgorithms diffie-hellman-group1-sha1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

儲存檔案後,重新用ssh對外連線,即可解決。

如果存檔有問題,記得用 sudo vi …. 提升寫入的權限。

iT邦幫忙 個人帳號:Kw6732