How to Fix “Warning: Remote Host Identification Has Changed”

Some time ago I upgraded the OS on one of my servers, then when I tried to access the server, it said “Warning: Remote Host Identification Has Changed”. Yes, it happened because I upgraded the OS. In short, the host key on the server has changed after we upgrade / reinstall the OS. For that, here’s how to fix “Warning: Remote Host Identification Has Changed”:

 

#The first way, delete the key we have with ssh-keygen

we can immediately delete the key with

ssh-keygen -R [ipServer or domainName.server]

example :

ssh-keygen -R 192.168.10.10
ssh-keygen -R lukems.com

 

#Second Way, Remove manual keys in ~/.ssh/known_hosts

Enter the ~/.ssh/known_hosts file with your favorite editor, then go to the line where the server key you want to delete is located, then delete it.

 

#hird way, just delete the ~/.ssh/known_hosts file 😆

This last method can be said to be the most extreme, just type rm -f ~/.ssh/known_hosts and all the keys you have will be erased. My advice, do this third method if you only have 1 key.

 

Also Read : Replace String in All Files on Linux

 

Next, if you have done one of the three methods, try remote ssh access to your server again, more or less it will be like this, type yes:

Now there are no more warning messages. That’s how to fix “Warning: Remote Host Identification Has Changed” that I know. Hopefully useful, Thank you ^^,

 

Lukems:

This website uses cookies.