4

I have the following error when I try to connect to my rpi over SSH:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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:/1AS9um/kBFfaIf0vny7UX8YyDP3nTCZhd2H5FAv2VY.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:1
  remove with:
  ssh-keygen -f "/root/.ssh/known_hosts" -R 192.168.1.234
ECDSA host key for 192.168.1.234 has changed and you have requested strict checking.
Host key verification failed.

I have found posts online related to that issue. The commom solution seems to be that you need to delete some line in that file. In my case it's: ssh-keygen -f "/root/.ssh/known_hosts" -R 192.168.1.234

However that file doesn't exist in my case and I still can't login on my rpi.

How can I solve this issue?

  • Have you tried using sudo? I am assuming you are not logged in as root. sudo ssh-keygen -f "/root/.ssh/known_hosts" -R 192.168.1.234 – joan Mar 18 '17 at 14:56
  • @joan yes I have, but still no such file. – traducerad Mar 18 '17 at 14:57
  • The host keys are in /etc/ssh I just had the same error. I copied the pub key that contained my PC name to my PC known_hosts file using a stick. – PaulF8080 Mar 22 '17 at 0:50
  • You can use file manager. Go into the View menu and click on Show Hidden. Then all will be revealed. In the end, you will want to use the command it suggests.. Then next time you connect will be like the first time ever - it will ask you to accept the key from the other server. Either that, or if it was a duplicate entry causing the problem (such as giving it a name in your /etc/hosts file), it makes sense to remove the entry listed only by IP address. – SDsolar May 2 '17 at 19:57
5

That file is not on RPI3 you are trying connect to, but on the computer where you are trying to connect FROM (Ubnutu?). Just run

ssh-keygen -f "/root/.ssh/known_hosts" -R 192.168.1.234

on your computer. Not on the Rpi.

| improve this answer | |
1

When that error comes up you need to remove the offending ECDSA key in

/root/.ssh/known_hosts:1 by copying line:

"ssh-keygen -f "/root/.ssh/known_hosts" -R 192.168.1.234" in your command line(This file is on the remote computer).

Then press enter. It will then ask if you really want to do this.

Then type in yes(not just y or enter) and it will clear the key off your Pi and you can sign in again.

Of course if someone is eavesdropping on you all bets are off!!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.