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