### Reference
### Version Information
All Servers OS : CentOS 6.8rsync : 1.26
### Network Infrastructure
Rsyncd Server (rsync_Server) : 192.168.10.100Backup Client (rsync_Client) : 192.168.20.100
### Config
## Execute following commands on rsync_Server
# set iptables
sudo /sbin/iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 873 -j ACCEPT
sudo /sbin/iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 873 -j ACCEPT
sudo /sbin/service iptables save
sudo /sbin/service iptables restart
sudo /sbin/service iptables restart
# daemonized rsync service and assign config file
sudo /bin/mkdir -p /etc/rsyncd
sudo /bin/mkdir -p /etc/rsyncd
cd /etc/xinetd.d
sudo /bin/sed -i 's/disable = yes/disable = no/' rsync
sudo /bin/sed -i '/server_args.*/d' rsync
sudo /bin/sed -i '/\{/i\ server_args = --daemon --config=\/etc\/rsyncd\/rsyncd.conf' rsync
cd /etc/rsyncd
sudo /bin/cat << EOF > rsyncd.conf
### GLOBAL OPTIONS ###
#motd file = /etc/rsyncd/rsyncd.motd
pid file = /var/run/rsync.pid
### GLOBAL OPTIONS ###
### Modules ###
[DATA_BACKUP]
path = /data/bak/rsync_backup_data
uid = root
gid = root
read only = no
use chroot = yes
# limit access
auth users = rsync_user
secrets file = /etc/rsyncd/rsyncd.passwd
hosts allow = 192.168.20.100
hosts deny = *
max connections = 5
# log
transfer logging = yes
log file = /var/log/rsync.log
log format = %t %a %m %f %b
#syslog facility = local3
#lock file = /var/run/rsync.lock
timeout = 300
### Modules ###
EOF
# setup rsync password file
sudo /bin/cat << EOF > /etc/rsyncd/rsyncd.passwd
rsync_user:rsync_pass
EOF
sudo /bin/cat << EOF > /etc/rsyncd/rsyncd.passwd
rsync_user:rsync_pass
EOF
sudo chown root:root /etc/rsyncd/rsyncd.passwd
sudo chmod 600 /etc/rsyncd/rsyncd.passwd
sudo chmod 600 /etc/rsyncd/rsyncd.passwd
## Execute following commands on rsync_Client# setup rsync password file
sudo /bin/cat << EOF > /etc/rsyncd/login.passwd
rsync_pass
EOF
rsync_pass
EOF
sudo chown root:root /etc/rsyncd/login.passwd
sudo chmod 600 /etc/rsyncd/login.passwd
sudo chmod 600 /etc/rsyncd/login.passwd
### Execute rsync to backup files
## Execute following commands on rsync_Client
# rsync from <src_backup_dir> to dst_dir(module:<DATA_BACKUP>)
sudo /usr/bin/rsync -av --delete --password-file=/etc/rsyncd/login.passwd <src_backup_dir>/ rsync_user@192.168.10.100::DATA_BACKUP