Search code examples
linuxssh

Host Key verification failed when ssh from windows command prompt?


When I tried to ssh my account on FreeBSD. It showed that host key verification failed. Some people say that I need to remove the old key. But I don't know what exactly is causing the problem. The picture on the top is the situation I saw and the picture at the bottom is the content of the known_hosts file.


Solution

  • What you have been told is correct, the problem is here that the destination machine's host key pair has changed and your machine is still referring to the old key.

    The solution is actually there in the error you are getting, just remove the key from the known_hosts and then ssh again and it will ask you to add the new key to known_host file which will fix your problem.

    One thing I noticed is that you are doing ssh to localhost and that too on a custom port 3022. Since you are windows and it does not comes with ssh server by default, have you enabled the ssh server on windows and if yes have you configured it to use port 3022 instead of 22 which is default ?