Automate SSH known_hosts cleanup
If you like me, you have to do a lot of installs1 of the same test machine with the same IP and have to ssh it you will notice this annoying message : 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 54:9d:c0:37:3a:80:48:6c:82:ec:d1:84:93:61:24. Please contact your system administrator. Add correct host key in /home/cboudjnah/.ssh/known_hosts to get rid of this message. Offending key in /home/cboudjnah/.ssh/known_hosts:595 Password authentication is disabled to avoid man-in-the-middle attacks. Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks. Agent forwarding is disabled to avoid man-in-the-middle attacks. I have automated the cleanup by a script : [code lang=“bash”] #!/bin/bash H=$1 ...