Remove "The authenticity of host XX can ' t be established" solution with SSH connection

Source: Internet
Author: User
Tags ssh rsync

But before I did the backup system recovery exercise, I found that my rsync had been a long time without sync success. I used to use the key exchange to complete the authentication in SSH, but may be due to changes in the host key, each SSH connection (or rsync) will be prompted: the authenticity of host * * can ' t be established, need to output a The interaction of "yes".

For this hint, my script was not predictable at first, so there was no judgment and processing (it was easy to handle with expect), so I decided to remove the hint (about the host's check).

1. When using SSH to connect to a remote host, add the option "-O Stricthostkeychecking=no" as follows:

Ssh-o Stricthostkeychecking=no 192.168.xxx.xxx

2. One way to completely remove this hint is to modify the configuration in the/etc/ssh/ssh_config file (or $home/.ssh/config) and add the following two lines of configuration:

Stricthostkeychecking No
Userknownhostsfile/dev/null

After modifying the configuration, restart the sshd service, the command is:/etc/init.d/sshd restart (or service sshd restart)
Of course, this is the intranet in the very trust between the server SSH connection, so do not consider security issues, directly removed the master key (host key) check.

"Host Key verification failed encountered in SSH." Problem is also related to the "stricthostkeychecking" configuration.

In addition, you do not need a username and password, but use SSH key authentication to achieve the Linux system ssh between the landing, you can refer to: Linux How to configure the dual-computer SSH trust and then two-way password-free landing

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.