LoginSignup
19
21

More than 5 years have passed since last update.

known_hostからホスト情報を削除する

Last updated at Posted at 2014-02-05

サーバの構成を変えたり、ネットワーク周りの設定を変更したりした後に
sshでそのサーバにログインしようとすると下記のようなメッセージが
表示されてサーバに接続できない場合があります。

$ ssh hogehoge@fugafuga.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:x.
Please contact your system administrator.
Add correct host key in ~/.ssh/known_hosts to get rid of this message.
Offending RSA key in ~/.ssh/known_hosts:57
RSA host key for fugafuga.com has changed and you have requested strict checking.
Host key verification failed.

これは、すごく大まかにいうと、
「今まで接続していたサーバとアドレスは同じだけど中身は違うっぽいよ?何かヤバそうだからサーバの管理者に確認してみて!!」
ということなので、身に覚えのない場合は、クラッキングされてたりする場合があるのですぐに調査してください。

そうでない場合、例えば下記のような場合はsshでサーバに入れなくなると困るので

  • サーバのネットワーク周りの設定を変えた
  • 自宅と会社で同じローカルIPをもつサーバにアクセスしようとした

この場合は下記コマンドでknown_hostからホストの情報を削除することで対応できます。

$ ssh-keygen -R fugafuga.com
19
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
21