How to deal with ssh's "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"?
- by Vi.
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:
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.
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.