Centos6.8 install and configure rsync
Install two packages in yum
yum install rsync xinetd
Enable the rsync service, restart the xinetd service, and disable SeLinux.
chkconfig rsync onservice xinetd restartsetenforce 0
Manually configure rsync content in the xinetd service
Specify the Service Startup parameter and find the row containing server_args.
server_args = --daemon --config=/etc/rsyncd/rsyncd.conf
Manually create/etc/syscnd/directory and file
cd /etc/mkdir rsyncdcd rsyncdtouch /etc/rsyncd/rsyncd.conftouch rsyncd.passwd rsyncd.passwdchmod 600 rsyncd.passwdvi rsyncd.conf
Rsyncd. conf file content example
uid = rootgid = rootuse chroot = noread only = yes#limit access to private LANshosts allow=124.3.1.3/255.255.255.0 11.16.52.249/255.255.255.0hosts deny=*max connections = 5pid file = /var/run/rsyncd.pidsecrets file = /etc/rsyncd/rsyncd.passwd#lock file = /var/run/rsync.lock#motd file = /etc/rsyncd/rsyncd.motd#This will give you a separate log file#log file = /var/log/rsync.log#This will log every file transferred - up to 85,000+ per user, per synctransfer logging = yeslog format = %t %a %m %f %bsyslog facility = local3timeout = 300# MODULE OPTIONS[module]path = /var/www/html/test/list=yesignore errorsauth users = usernamecomment = test# exclude = cache/
Configure rsyncd. passwd
vi /etc/rsyncd/rsyncd.passwd
Add user name and password
username:password
Open the firewall iptables Port
vi /etc/sysconfig/iptables
Add a new row in the appropriate location
-A INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT
Rsync command example
rsync -avz --progress username@11.16.52.249::module ./test
Enter the password.
If you encounter any problems, check the system status.
getenforcenetstat -an | grep 873