Rsync Security Configuration and rsync Configuration
I will not talk about rsync deployment here. This article mainly describes how to access rsync through the user name and password:
I. rsync server security configuration
1. Create a password file and modify permissions
Touch/etc/rsync. pass
Content: root: 123456
Modify/etc/rsync. pass to 600
chmod 600 /etc/rsync.pass
2. Modify the rsync configuration file/etc/rsyncd. conf.
Add the following two lines:
secrets file = /etc/rsync.passauth users = root
The configuration file contains the following content:
uid = rootpid file=/var/run/rsyncd.pidlog file=/var/log/rsyncd.logsecrets file = /etc/rsync.passauth users = root[temp] path = /data0 read only = no
3. Restart the rsync Process
Kill the rsync process:
Ps-aux | grep rsync
Kill-9 $ {pid}
Start the rsync process:
Rsync -- daemon
Ii. Secure Access to the rsync Client
1. manually enter the password
rsync root@10.73.20.37::temp/yarn-site.xml .Password:
2. Create a password file and specify a password file based on configuration items.
Rsync root@10.73.20.37: temp/yarn-site.xml. -- password-file = rsync. pass
Here, rsync. pass only has the password 123456, the user name has been specified in the command line, and the rsync. pass File Permission is changed to 600.
3. export environment variable, password-free rsync
export RSYNC_PASSWORD=${pass}
After setting the environment variable RSYNC_PASSWORD, you can use rsync without a password:
rsync root@10.73.20.37::temp/yarn-site.xml .
The following describes the environment variable RSYNC_PASSWORD:
RSYNC_PASSWORD
Setting RSYNC_PASSWORD to the required password allows you to run
Authenticated rsync connections to an rsync dae-mon without user
Intervention. Note that this does not supply a password to a shell transport such as ssh.