2012/08/27

remotehostのIP変えたらssh出来なくなったの巻

remotehostのIPをDHCPからの配布から固定に変更して、ほんじゃこれからゴニョゴニョとして見ましょうかと、

$ssh -l hogehoge 10.100.100.102

としたら、盛大に


@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 is
3a:fd:0a:xx:d4:xx:b5:cc:xx:68:2e:55:xx:65:xx:xx.
Please contact your system administrator.
Add correct host key in /Users/hogehoge/.ssh/known_hosts to get rid of this message.
Offending RSA key in /Users/hogehoge/.ssh/known_hosts:5
RSA host key for 10.100.100.102 has changed and you have requested strict checking.
Host key verification failed


怒られました。

そこで、ググってみるとssh周りのオプションがいろいろと。
が、これというオプションが見つからない。で、基本に戻って

$man ssh-keygen

してみると、

ssh -keygen -R hostname
Removes all keys belonging to hostname from a known_hosts file.  This option is useful to delete hashed hosts (see the -H option above).


これでした。

$ssh-keygen -R 10.100.100.102

/Users/hogehoge/.ssh/known_hosts updated.
Original contents retained as /Users/hogehoge/.ssh/known_hosts.old

$ssh -l hogehoge 10.100.100.102

The authenticity of host 'myRemoteHost' can't be established.
RSA key fingerprint in md5 is: 3a:fd:0a:xx:d4:xx:b5:cc:xx:68:2e:55:xx:65:xx:xx.
Are you sure you want to continue connecting(yes/no)? 


つながりました。

なにかわからない -> ググってみる。
もはやパブロフの犬状態で、基本の「キ」の字の

$man hogehoge

してみることを忘れてました。自分の情報検索の方法を少し反省です。

0 件のコメント:

コメントを投稿