2020/11/17

ssh接続をしたときno matching key exchange method found.と言われて接続できない

問題

ssh接続をしたときno matching key exchange method found.と言われて接続できない。

環境

クライアント側

Windows 10 Pro
MSYS2 64bit
$ ssh -V
OpenSSH_8.4p1, OpenSSL 1.1.1h  22 Sep 2020

サーバ側

$ cat /etc/redhat-release
CentOS release 5.9 (Final)
$ ssh -V
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008

エラーの内容

$ ssh user@***.***.***.***
Unable to negotiate with ***.***.***.*** port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

解決方法

~/.ssh/config ファイルに以下の設定を追加する。
該当のファイルがなければ新規作成する。
Host ***.***.***.***
KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

 

原因

下記サイトによるとOpenSSHのバージョンが古いために発生した問題の模様です。

本来はサーバ側のOpenSSHのバージョンを上げたほうがいいのですが、私の管理外のため上記クライアント側の対応で解決しました。

0 件のコメント: