Use the dual-Host Authentication mechanism to avoid entering scp and ssh logon passwords

Source: Internet
Author: User
Article Title: using the dual-Host Authentication mechanism to avoid entering scp and ssh logon passwords. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Using scp or rsync for remote data transmission without a password, the first problem to be solved is the trust relationship between the two servers. You can perform the following operations:

First, run the following command on the backup server as the root user:

# Ssh-keygen-t rsa

Then press enter until it reaches/root /. the id_rsa and id_rsa.pub files are generated under ssh/. id_rsa is the key, id_rsa.pub is the public key, and id_rsa.pub is copied to the/root/of the data server to be backed up separately /. ssh/, and renamed it authorized_keys:

# Scp/root/. ssh/id_rsa.pub root @ serverslave IP:/root/. ssh/authorized_keys

# Scp/root/. ssh/id_rsa.pub root @ server2_ip:/root/. ssh/authorized_keys

Then, you can use ssh or scp to test the server connection from the backup server:

# Ssh root @ serverslave IP

# Scp root @ serverslave IP:/tmp/test. tgz.

If you do not need to enter the password to log on or copy the file to your local computer without entering the password, the setting is complete.

The following describes how to use the rsync Remote Data Synchronization command:

Rsync-vzrtopg root @ serverslave IP:/beifen/*/beifen

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.