Our system admin seems to reinstall hosts quite often, and so the ssh host key changes often for various hosts.
I’ll see something like this semi-often, resulting in me not logging in without first fixing the known_hosts file:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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
92:0b:c9:7c:be:44:06:0d:87:cd:4b:d7:ec:40:c0:62.
Please contact your system administrator.
Add correct host key in ~/.ssh/known_hosts to get rid of this message.
Offending key in ~/.ssh/known_hosts:30
RSA host key for be has changed and you have requested strict checking.
Host key verification failed.
It’s a relatively simple fix; open the file, remove the offending line. That’s codetty annoying and I wanted a quick solution to resolve. And then I remember ‘sed’.
sed -i 30d ~/.ssh/known_hosts
‘-i’ : edit file inline.
’30d’ : ‘d’ or delete command, so ‘delete line 30’.