SSH接続を行うと何回も「Warning: the ECDSA host key for 〜」と表示される
こんにちはKUJIRAです。今日はSSH接続した時に発生したエラーについてまとめます。
事象
SSH接続を行うと以下のエラーが表示される。
$ ssh hoge@XXX.XXX.XXX.XXX Warning: the ECDSA host key for 'xxxxxxxxx' differs from the key for the IP address 'XXX.XXX.XXX.XXX' Offending key for IP in /home/hoge/.ssh/known_hosts:10 Matching host key in /home/hoge/.ssh/known_hosts:1 Are you sure you want to continue connecting (yes/no)?
一度表示されたらログインするたびに何度も聞かれる。
原因
ホームディレクトリ配下にあるknown_hostsファイルにログイン対象のホスト情報に対して鍵が重複して登録されていることが原因です。
$ ssh hoge@XXX.XXX.XXX.XXX Warning: the ECDSA host key for 'xxxxxxxxx' differs from the key for the IP address 'XXX.XXX.XXX.XXX' Offending key for IP in /home/hoge/.ssh/known_hosts:10 ※ここの部分が問題を起こしているので削除する必要がある。 Matching host key in /home/hoge/.ssh/known_hosts:1 Are you sure you want to continue connecting (yes/no)?
対処
known_hostの対象行を削除する必要があります。
$ vim ~/.ssh/known_hosts ※開いたら対象の行を削除
以上で解決です。結構あっけないのですが、意外にどうすればいいのか分からなかった。。。あと忘れるwww ということで今日はここまで。KUJIRAでした。
“SSH接続を行うと何回も「Warning: the ECDSA host key for 〜」と表示される” への1件のフィードバック