[clue-tech] ssh, vim helper

David L. Willson DLWillson at TheGeek.NU
Thu Oct 16 21:26:59 MDT 2008


>From the "everyone but me already knows this" department:

Have you ever gone to ssh a host you'd rebuilt recently, and gotten one of these?

$ ssh smi-admin at 10.0.1.2
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
7a:0b:f3:8a:52:e0:1a:e3:f6:26:b3:e8:31:a0:af:cf.
Please contact your system administrator.
Add correct host key in /home/dlwillson/.ssh/known_hosts to get rid of this message.
Offending key in /home/dlwillson/.ssh/known_hosts:95
RSA host key for 10.0.1.2 has changed and you have requested strict checking.
Host key verification failed.

Well, I get them all the time, and I found the easy way to delete the old key, but
quick.  Notice that it gives you the line-number of the offending key, so you can use
the "start at line" shortcut when starting vim to go straight to it when you edit your
known_hosts file.  Like this:

dlwillson at aurora:~
$ vim +95 .ssh/known_hosts 

Now, you just key in ddZZ (dd deletes the bad key, and ZZ saves and quits) and try your
ssh again.

-- David



More information about the clue-tech mailing list