Resolve SSH Host key Verification failed error

In this article, we will resolve SSH host key verification failed error in Linux.

Host keys are key pairs, typically using the RSA, DSA, or ECDSA algorithms. Public host keys are stored on and/or distributed to SSH clients, and private keys are stored on SSH servers.

SSH host key verification is a Linux/Unix security method to keep a hash fingerprint of all the ssh host that connects to your machine. When verification fails to authenticate it usually means the remote host ssh fingerprint was changed commonly due to an OS reload.

If you are getting following error, this article will help you to resolve it.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ 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 the RSA host key has just been changed. The fingerprint
for the RSA key sent by the remote host is b7:f5:48:4c:d0:1d:76:6a:50:4a:88:12:c7:80:f1:e5. Please contact your system administrator. Add
correct host key in /home/user/.ssh/known_hosts to get rid of this message. Offending key in /home/user/.ssh/known_hosts:300 RSA host key for
myhost has changed and you have requested strict checking. Host key verification failed. – See more

Step 1: The error message says that the file that we need to remove is located on line 300 of your know_host.


Step 2: Edit known_hosts file using editor

# vi 300 /home/user/.ssh/known_hosts

Step 3: Remove line number 300

Once you open the known_hosts straight to line 300 do the following keyboard commands press “ESC dd” to delete the line. You can save the changes by pressing “esc” and typing “:wq!”.

That’s it. Now try to ssh the server using ssh host key.

We have seen how to resolve SSH host key verification failed error in Linux.

[Need assistance to fix this error or install tools? We’ll help you.]

Related Articles