sshコマンドで
問題
PowerShellのsshコマンドで古いLinuxに接続しようとしたら、以下のエラーになり、接続できません。
Unable to negotiate with xxx.xxx.xxx.xxx port xx: no matching host key type found. Their offer: ssh-rsa,ssh-dss
答え
接続先が古く、サーバーとクライアントで共通の暗号化方式ないと接続できず、エラーになります。
PowerShellのsshクライアントに限らず発生します。
コマンドラインオプションで対応する例
ssh -oHostKeyAlgorithms=+ssh-dss xxx.xxx.xxx.xxx
または
ssh -oHostKeyAlgorithms=+ssh-dss -oPubkeyAcceptedAlgorithms=ssh-dss,ssh-rsa xxx.xxx.xxx.xxx
設定で対応する例
~/.ssh/config
Host xxx.xxx.xxx.xxx
HostKeyAlgorithms ssh-dss,ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa