There are two types of rsync operations
1. Start the rsync daemon
2. Use remote shell to process
Only the second case is recorded here, which is simpler. In fact, rsync uses SSH to authenticate users. In the absence of SSH authentication, you generally need to enter the user name and password, for example: rsync-avz -- Progress -- RSH = ssh/var/lib/MySQL root@192.168.1.2:/var/lib/MySQL, after executing this sentence, the system will prompt you to enter the user root password, in this way, the program is very uncomfortable.
Add SSH authentication:
# Ssh-keygen-T RSA
After a carriage return, two files, id_rsa id_rsa.pub, are generated. id_rsa is the private key and id_rsa.pub is the public key.
You can upload the public key to the backup server.
# SCP id_rsa.pub root@192.168.1.1: server_1
The file is stored in the user directory, and the server_1 file is copied to the. Ssh directory under the user directory.
# Mv server_1. Ssh/
Finally, import the keyAuthorized_keys File
# Cat server_1>Authorized_keys
In this way, you do not need to enter the password.
Each user has a corresponding user directory. For details, see/etc/passwd.