
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
More posts in my blog ElBruno.com.
More info in https://beacons.ai/elbruno
References
My posts on Raspberry Pi β‘π²β‘
Dev posts for Raspberry Pi
- How to grant permissions to a folder after git clone, to perform dotnet restore on a Raspberry Pi
- How to install .Net Core 3.1 in a Raspberry Pi 4
- Installing Visual Studio Code in a Raspberry Pi 4, run as root, fix black screen
- How to install .Net Core in a Raspberry Pi 4 and test with Hello World
- Build and Run C# NetCore projects in a Raspberry Pi 4 with Visual Studio Code
- Letβs do some Git dev in Raspberry Pi 4 (GitHub and Azure DevOps!)
- Install OpenCV
- Install Python π Virtual Environments in Raspberry Pi
- Setup SSH passwordless access to remote work with Docker π³
- Manage Docker π³ as a non-root user
- Build Docker π³ images from Visual Studio Code remotely using a Raspberry Pi
Tools and Apps for Raspberry Pi
- Where is my Task Manager in RaspberryPi? Letβs try htop
- Multi-monitor πΊ in Raspberry Pi 4 rocks !
- Double Commander on RaspberryPi4, because files are important
- How to install Docker π³ in a Raspberry Pi 4
- Installing Visual Studio Code in a Raspberry Pi
- Installing Visual Studio Code in a Raspberry Pi, run as root, fix black screen (Updated)
- 6 commands to install OpenCV for Python π in a Raspberry Pi 4
Setup the device
- 1st Setup without monitor πΊ: auto connect to WiFi πΆ, enable SSH, update and more
- Setup without monitor: enable VNC
- How to enable auto start with HDMI safe mode
- Running a Python π script in a Python Virtual Environment on reboot / startup
- Setup Wifi on Ubuntu
I came about your post because I had the exact thing happening on my raspberry Pi but I only shut it down and turned it on the next day. No re-flashing or similar action.
Even worse, I could not fix it, e.g. copy a new key the Pi closed connection every time I put in my password. Could not ssh into it – same thing closed connection on port 22. Truly puzzled what happened here. Now I re-flashed and I’ll set it up from scratch. Maybe you have some insight on what is happening here. I need to be able to work with this hardware without jumping through the hoops like this.
Any tip is greatly appreciated.
LikeLike
Thanks, it worked.
LikeLike