Remove SSH Key – Fix Warning ECDSA Host Key Differs

  General, Linux

If you ssh to a box and get the following error message:

Warning: the ECDSA host key for 'host' differs from the key for the IP address '192.168.1.1'

It means that, or someone is doing something nasty on your network, like a Man in the middle attack, or you have recently reinstalled your host, and now this IP has a new ssh key. In this case, to fix it, simply remove the old key you have matching this ip with the followin command:

ssh-keygen -R 192.168.1.1

It may also be required to remove the key by host name. In this case, the command would look like this:

ssh-keygen -R host

 

Leave a comment