Linux known_host files for SSH

Source: Internet
Author: User

In peacetime work, sometimes need SSH login to other Linux host up, but sometimes SSH login will be banned, and pop up the following similar hint:

Warning:remote HOST identification has changed!it are POSSIBLE that SOMEONE are DOING SOMETHING nasty! Someone could is eavesdropping on your right now (Man-in-the-middle attack)! It is also possible, the RSA host key has just been changed. The fingerprint for the RSA key sent by the remote host IS36:68:A6:E6:43:34:6B:82:D7:F4:DF:1F:C2:E7:37:CC. Please contact your system administrator. Add correct host key in/u/xlian008/.ssh/known_hosts to get rid of the this message. Offending key In/u/xlian008/.ssh/known_hosts:2rsa host key for 135.1.35.130 had changed and you have requested strict Che Cking. Host Key verification failed.


It was rather strange, so I studied it a bit.
SSH will record every public key you have accessed your computer in ~/.ssh/known_hosts. The next time you access the same computer, OpenSSH checks the public key. If the public key is different, OpenSSH warns you against attacks such as DNS hijack. This is the situation I have listed above.

Cause: There are more than one Linux system on a host, will switch frequently, then these systems use the same IP, log in once after the SSH information is recorded in the local ~/.ssh/known_hsots file, switch the system and then SSH access to this host will be a conflict warning, You need to manually delete the contents of the modified known_hsots.


The following two solutions are available:
1. Manually delete the contents of the modified known_hsots;
2. Modify the configuration file "~/.ssh/config", plus these two lines, restart the server.
Stricthostkeychecking No
Userknownhostsfile/dev/null


Advantages and Disadvantages
1. You need to manually delete the contents of the file, some automation scripts can not be run (when SSH login failed), but high security;
2. SSH login will ignore known_hsots access, but the security is low.

Linux known_host files for SSH

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.