iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
👌

How to Fix the 'REMOTE HOST IDENTIFICATION HAS CHANGED!' SSH Warning

に公開

In such cases

ssh example.com

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
Please contact your system administrator.
Add correct host key in /Users/anata_no_user_name/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /Users/anata_no_user_name/.ssh/known_hosts:26
ECDSA host key for xx.xx.xxx.xxx has changed and you have requested strict checking.
Host key verification failed.

*Note: This can happen when you recreate a cloud server instance and the external IP address changes, etc.

Do this

ssh-keygen -R example.com # <- HOSTNAME

This removes the key for the specified host from ~/.ssh/known_hosts.
You can also manually edit the known_hosts file to remove it.

Discussion