Paul's Programming Notes     Archive     Feed     Github

ssh-keygen -R hostname

I’ve been manually removing the line from .known_hosts when I saw this message:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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 ECDSA key sent by the remote host is
SHA256:<key>.
Please contact your system administrator.
Add correct host key in /Users/<user>/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/<user>/.ssh/known_hosts:85
ECDSA host key for <ip> has changed and you have requested strict checking.
Host key verification failed.

Today I found out about this command to remove entries from known_hosts: ssh-keygen -R hostname