Linux SSH remote login error solution WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED

When I recently logged into a machine, I found that I couldn’t wait to log in, and the following error occurred:

So I went to my mother (I have to say that search engines are a good thing), and after searching for a long time, I found that there was an article that mentioned the .ssh /known_hosts file, and it turned out that there was this file:

I just thought what this file is. After checking it, I realized that known_hosts is a file that records the public key of the remote host . I reinstalled a system before, and the saved public key is still the system public key of the system that has not been reinstalled. When the ssh connection is made, the public key will be verified first. If the public key is incorrect, an error will be reported.

Solution:

1. Delete the public key of the IP with the wrong login in the known_hosts file. The following picture is the public key of my 218 machine (in fact, the public key of the previous system), then delete it, and then ssh login to great login successfully .

2. Clear the contents of the known_hosts file, but this method is not recommended. The public keys of other machines are also stored in it.

3. Use the shh-keygen command ( this method is strongly recommended )

For example, if we want to clear the public key information of 172.16.152.209, use the command (please replace 172.16.152.209 with your own IP or domain name):

 ssh-keygen -R 172.16.152.209

As shown below:

After that, you can log in again and ask to confirm whether the public key is:

So far, the ssh link error has been successfully resolved, and it is recorded here for query.

The post Linux SSH Remote Login Error Solution WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8837
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment