What is rsync?
Activity
# yum install rsync
# systemctl enable rsyncd
pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsync.logport = 12000uid = rootgid = root
[web-public]path = /usr/share/htmlcomment = Web Static Filesread only = falsetimeout = 300
After save the config file, start the rsyncd service.
# systemctl start rsyncd
# systemctl status rsyncd
# /bin/rsync -rda rsync://192.168.1.17:12000
# /bin/rsync -rda rsync://192.168.1.17:12000/web-public /usr/share/html/
Step 4: Secure the rsync
- Allow only for specific source IPs
hosts allow = 192.168.1.18hosts deny = *pid file = /var/run/rsyncd.pidlock file = /var/run/rsync.locklog file = /var/log/rsync.logport = 12000uid = rootgid = root
- Adding Usernames and Passwords
You can make your rsync daemon more secure by adding a username and password requirement in its configuration file. Open /etc/rsyncd.conf add these configurations.
[web-public]path = /usr/share/htmlcomment = Web Static Filesread only = falsetimeout = 300auth users = rsync1,rsync2secrets file = /etc/rsyncd.secrets
Now create credential file "/etc/rsyncd.secrets" and add these users.
rsync1:123123rsync2:123123rsync3:123123
Once you have saved this file, secure it so only the root user can read or edit it.
# chmod 600 /etc/rsyncd.secrets
Now restart the service and very the configurations. First try to sync in normal way without an user.
# /bin/rsync -rda rsync://192.168.1.17:12000/web-public /usr/share/html
It will prompt for password. Now try to sync the files by specifying the user we put in the "rsyncd.secrets" file.
# /bin/rsync -rda rsync://rsync1@192.168.1.17:12000/web-public /usr/share/html









No comments:
Post a Comment