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 ''

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

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