Host Key Verification Failed

user1985351 picture user1985351 · Sep 26, 2013 · Viewed 39k times · Source

I'm trying to ssh into my UBUNTU through my PC with Cygwin on it. I can WINSCP without a hitch, however when I ssh through a command line it comes up with this error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@    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
5d:84:de:4e:a8:81:df:22:06:23:98:34:cd:26:f5:1a.
Please contact your system administrator.
Add correct host key in /home/Trevor/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/DIRECTORY
ECDSA host key for HOSTNAME has changed and you have requested strict checking.
Host key verification failed.

So I looked it up and it said that I needed to change my host key in my .ssh folder that's located in my home folder. Well, there wasn't one so I made one. Tried again and got the same error.

What to do?

Answer

Suhas.s picture Suhas.s · Dec 1, 2014

"Host key verification failed" means that the host key of the remote host was changed.

Ssh stores the host keys of the remote hosts in ~/.ssh/known_hosts. You can either edit that text file manually and remove the old key (you can see the line number in the error message), or use

ssh-keygen -R hostname