Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
Ignore known-hosts security in SSH for some addresses

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 root@172.1.2.3
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 root@172.1.2.3
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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.
root@172.1.2.3's password:

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

share|improve this question

marked as duplicate by Renan, Synetech, 8088, Hennes, BBlake Nov 6 '12 at 19:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

For a slight workaround, you can use ssh-keygen -R ip to remove the stored key for that IP.

Alternately, you can alias ssh to something like ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no which doesn't complain or ask to verify. Remove the StrictHostKeyChecking=no if you are okay with still seeing it and verifying it.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.