物理の駅 Physics station by 現役研究者

テクノロジーは共有されてこそ栄える

古いOSへSSH接続時のエラーへの対処

$ ssh -X physics@station
Unable to negotiate with 192.168.0.2 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

と出るときは ~/.ssh/config

Host station
    HostName 192.168.0.2
    User physics
    KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

KexAlgorithms を追加する。なおも以下のようなエラーがでる場合は

$ ssh -X physics@station
Unable to negotiate with 192.168.0.2 port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss

~/.ssh/configHostKeyAlgorithms を追加する。

Host station
    HostName 192.168.0.2
    User physics
    KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
    HostKeyAlgorithms ssh-dss,ssh-rsa

ちなみに接続元のSSHのバージョン

$ ssh -V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f  31 Mar 2020