Raspberry PiでIoTなシステム開発:ssh Warning: the RSA host key for differs from the key for the IP address

いつからかRaspberry Piにログインしようとしたら、以下の警告文が表示されるようになりました。

kawauchiyasuo-no-MacBook-Pro:~ yasuo$ ssh pi@raspberrypi.localWarning: the RSA host key for 'raspberrypi.local' differs from the key for the IP address '192.168.2.10'Offending key for IP in /Users/yasuo/.ssh/known_hosts:9Matching host key in /Users/yasuo/.ssh/known_hosts:11Are you sure you want to continue connecting (yes/no)? yespi@raspberrypi.local's password: Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7lThe programs included with the Debian GNU/Linux system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.Last login: Mon Feb  8 12:10:07 2016 from kawauchiyasuo-no-macbook-pro.localpi@raspberrypi ~ $

yesと答えればログインできるわけですが、警告無視というのは気持ち悪いですし、ログイン完了まで一手間増えるのも面倒です。対策を探したらこちらに情報が。[Ubuntu]ssh 接続しようとすると「WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!」が表示されるときはクライアント側のキーの問題なんですね。で、これはWindowsなのでMacの場合はこちら。https://gjroo.wordpress.com/2010/10/07/ssh-warning-the-rsa-host-key-for-differs-from-the-key-for-the-ip-address/自分の場合は保存をしておかないといけないホストは特にないので全部削除しました。

kawauchiyasuo-no-MacBook-Pro:~ yasuo$ cd .ssh/kawauchiyasuo-no-MacBook-Pro:.ssh yasuo$ lsknown_hostskawauchiyasuo-no-MacBook-Pro:.ssh yasuo$ nano known_hosts kawauchiyasuo-no-MacBook-Pro:.ssh yasuo$ ssh pi@raspberrypi.localThe authenticity of host 'raspberrypi.local (192.168.2.10)' can't be established.RSA key fingerprint is 1e:5f:a9:82:bf:06:e3:a2:fc:4e:b9:51:f7:d6:36:97.Are you sure you want to continue connecting (yes/no)? yesWarning: Permanently added 'raspberrypi.local,192.168.2.10' (RSA) to the list of known hosts.pi@raspberrypi.local's password: Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7lThe programs included with the Debian GNU/Linux system are free software;the exact distribution terms for each program are described in theindividual files in /usr/share/doc/*/copyright.Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extentpermitted by applicable law.Last login: Mon Feb  8 12:24:16 2016 from kawauchiyasuo-no-macbook-pro.localpi@raspberrypi ~ $ exitlogoutConnection to raspberrypi.local closed.kawauchiyasuo-no-MacBook-Pro:.ssh yasuo$ ssh pi@raspberrypi.localpi@raspberrypi.local's password:

無事警告無しでログインできるようになりました。(2016/02/09追記)

kawauchiyasuo-no-MacBook-Pro:~ yasuo$ ssh pi@raspberrypi.local@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!Someone could be eavesdropping on you right now (man-in-the-middle attack)!It is also possible that a host key has just been changed.The fingerprint for the RSA key sent by the remote host is19:8d:b0:b4:05:66:a1:67:37:e0:15:29:45:2f:69:2b.Please contact your system administrator.Add correct host key in /Users/yasuo/.ssh/known_hosts to get rid of this message.Offending RSA key in /Users/yasuo/.ssh/known_hosts:1RSA host key for raspberrypi.local has changed and you have requested strict checking.Host key verification failed.

piを再インストールしたら今度はこんなメッセージが。この場合も原因は同じなのでknown_hostsから該当行を削除したらアクセスできました。   “””

コメントをどうぞ

メールアドレスが公開されることはありません。 が付いている欄は必須項目です