How to solve the ssh login error WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!

reason:

When two devices are connected for the first time, the public key information of the connected device will be saved in ~/.ssh/konwn_hosts, and when they are connected again laterOpenSSH Will check the public key for a simple verification

However, sometimes the connected device system is reinstalled, IP conflicts and other reasons may cause the public key information to not match, so this error occurs.

solution:

In fact, it is very simple. Just delete the public key information recorded in the path ~/.ssh/konwn_hosts and re-establish a new link. The command:

ssh-keygen -R XXX (ip address) 

Just perform this action, and even thoughtfully back up the original public key information.

Of course, you can also manually delete the specified IP and use vi/vim to open the konwn_hosts file. You will find that the contents are in ciphertext. This is because of the security mechanism in the new version of the system to prevent some unscrupulous people from conducting remote operations. After spreading the poison, the plain text storage is replaced by the cipher text calculated by the algorithm. Of course, you can use the following command to query the cipher text of a certain IP:

ssh-keyscan XXX (IP address)

Then you can see that the ciphertext information calculated by three different algorithms is output.

We find these ciphertext information in the konwn_hosts file, delete it, save it, and relink it. Of course, if you feel that encryption is not necessary for personal use of the computer, you can also turn off encryption and use vi/vim to edit the fields in the path /etc/ssh/ssh_config: HashKnownHosts

Modify this field to no, save and exit, delete the public key information and re-link. You will find that the newly saved public key is plain text information.​ 

Guess you like

Origin blog.csdn.net/BenChiZhuBaDaoWang/article/details/134142890