Once I try to connect a fresh new installed system, which has the same name or ip before through ssh,  logging in to the client may fail. The reason is that the new system has the different host key. In that case, find the host key and remove them, and try to connect to it again. The new updated host key will be saved into $HOME/.ssh/known_hosts


Find the Host Key as : 


user@host:~$ ssh-keygen -F 0.0.0.11

# Host 0.0.0.1 found: line 25 type ECDSA

|1|fqIKruXgQiBiaC3m8BBjyMTyxjE=|tn1kZ4Xc0QFRHtP9ktfjfAfH6tU= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyN6644sgxjr4zdHAyNTYAAABBBCnqFheVaXkvg6Zozli0WpkMRcPgOtir9X3t58loczY9//iTSWdKBEHNVKBP+DaTAII/JRs/7Id0vD8G1vGpFd8=


Remove the Host Key as :


user@host:~$ ssh-keygen -R 0.0.0.11

/home/user/.ssh/known_hosts updated.

Original contents retained as /home/user/.ssh/known_hosts.old



posted by citadel