Examples:
When I try to SSH somewhere and get the big, scary MITM warning and know about / expected the change, I simply have to hit ⬆️ , Ctrl+a
, and type fix
then hit ↩️ and I'll be on the machine in a moment.
$ ssh somemachine
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ 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 a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
5a:59:e0:fe:60:f4:c6:01:c3:9e:0a:58:d2:72:c1:0f.
Please contact your system administrator.
Add correct host key in /home/frick/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/frick/.ssh/known_hosts:411
remove with: ssh-keygen -f "/home/frick/.ssh/known_hosts" -R somemachine
RSA host key for somemachine has changed and you have requested strict checking.
Host key verification failed.
frick@frick:~$ fixssh somemachine
# Host 10.144.144.44 found: line 69 type RSA
/home/frick/.ssh/known_hosts updated.
Original contents retained as /home/frick/.ssh/known_hosts.old
# Host somemachine found: line 410 type RSA
/home/frick/.ssh/known_hosts updated.
Original contents retained as /home/frick/.ssh/known_hosts.old
[frick@somemachine ~]$