#RaspberryPi – How to solve the SSH warning: WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

Buy Me A Coffee

Hi !

When you test and play around with your Raspberry Pi, you may need to format again your Raspbian SD Card, and then start everything from scratch. This is a trivial process, and is usual to setup the device to connect automatically to a Wifi network and also enable SSH (I wrote about this, see references).

And then, when you try to connect via SSH you may get this warning

 C:\Users\bruno> ssh pi@192.168.1.247
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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: Not here ! 
Please contact your system administrator.
Add correct host key in C:\\Users\\bruno/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in C:\\Users\\bruno/.ssh/known_hosts:10
ECDSA host key for 192.168.1.247 has changed and you have requested strict checking.
Host key verification failed.

This is a very common scenario, and because I forgot how to fix it, I’ll write the simple command remove all keys belonging to the IP / hostname from the known_hosts file.

# ssh-keygen -R <host>
ssh-keygen -R 192.168.1.247

And that’s it, keys removed and now I can connect via SSH

Happy coding!

Greetings

El Bruno

References

My posts on Raspberry Pi

Dev posts for Raspberry Pi
Tools and Apps for Raspberry Pi
Setup the device
Hardware

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.