Macで今までできていたssh接続ができない?

エンジニア

最近僕のMacでサーバーにssh接続できなくなる事象が発生しました。今までちゃんと接続できていたサーバーです。

エラーには以下が書かれていました。

Unable to negotiate with xxx.xxx.xxx.xxx port 1220: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

Macのssh接続で使えなくなった暗号方式があるようです。そのためエラーで書かれている暗号方式を~/.ssh/configファイルでKexAlgorithmsを指定すれば良いです。

変更前

Host test001
 HostName test001.example.com
 Port 1220
 User testuser

変更後

Host test001
 HostName test001.example.com
 Port 1220
 User testuser
 KexAlgorithms +diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1