How to deal with ssh's "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"?

Posted by Vi. on Super User See other posts from Super User or by Vi.
Published on 2012-11-06T15:53:42Z Indexed on 2012/11/06 17:06 UTC
Read the original article Hit count: 199

Filed under:
|
|
|

I often need to login to multiple remote stations that are just placed to the same static IPs for me. SSH complains about changed keys in this case:

$ ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
...
Offending RSA key in /home/vi/.ssh/known_hosts:70
...

I usually just run vim /home/vi/.ssh/known_hosts +70, dd wq and re-run the SSH command.

How to do it simpler?

Requirements:

  1. The warning should be displayed, and not like this:

    The authenticity of host '172.1.2.3 (172.1.2.3)' can't be established.
    
  2. It is easy to accept the key change.

I expect something like this:

$ ssh [email protected]
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
...
The fingerprint for the RSA key sent by the remote host is
82:cd:be:7a:ae:1b:91:2c:23:c1:74:4d:8a:38:10:32.
Change the host key in /home/vi/.ssh/known_hosts (yes/no)? yes
Warning: Changed host key for '172.1.2.3' (RSA) in the list of known hosts.
[email protected]'s password:

Simple and differs from usual "The authenticity of host can't be established." message.

© Super User or respective owner

Related posts about linux

Related posts about ssh