Fixing offending key in SSH known hosts


In the event the ip address of your server changes and you are using a private key there is a quick fix. From the example above you see that my offending key is “known_hosts:1” or key 1. To fix the error lets remove the line 1 of the known hosts. This solution was performed in CentOS 6.x using the sed command. The sed command is used for processing of files. Sed stands for Stream Editor which parses text files and used for making textual transformations to a file. The command is applied on the specified file on a line by line basis.

After running this command the offending key should be removed, and you should be prompted to add the new ip of the server to the known hosts.