[CentOS] need document to setup rsync???

Alan McKay alan.mckay at gmail.com
Thu May 6 14:06:35 UTC 2010


What do you want to rsync from where to where?

It is really easy to set up - in fact I just got done writing an
internal wiki page on how to do a simple setup.

The following is what I use for my kickstart servers so the main
server can rsync itself out to slave servers.  This sets up
/var/www/html/ks on the slave server as an rsync share that the master
can write to


/etc/rsyncd.secrets
---snip---
kickstart:user
---snip---

This file must be set to permissions 0600


and the main config file

/etc/rsyncd.conf

Here we use a subdirectory of the main default Apache directory which
is /var/www/html
---snip---
# Set this if you want to stop rsync daemon with rc.d scripts
pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log

# Edit this file before running rsync daemon!!

uid = root
gid = root
#use chroot = no
max connections = 3
#syslog facility = local5

[ks]
        path = /var/www/html/ks
        comment = Kickstart
        read only = no
        auth users = kickstart
        hosts allow = 192.168.0.9
        secrets file = /etc/rsyncd.secrets
---snip---

Note in the hosts allow above we put the IP address of the main
kickstart server.

/etc/xinetd.d/rsync

Just update this file and change disable from yes to no

service rsync
{
	disable	= no
	socket_type     = stream
	wait            = no
	user            = root
	server          = /usr/bin/rsync
	server_args     = --daemon
	log_on_failure  += USERID
}
Now restart xinetd (and ensure it is turned on by default)

Then on the main server I run a script like this :

---snip---
export SLAVES="192.168.0.177"
export USER=kickstart
export RSYNC_PASSWORD=user

for slave in $SLAVES
do
	ping -c 3 -w 3 $slave > /dev/null	2>&1
	if [ $? -eq 0 ]
	then
		rsync  -avSHP --delete --exclude "local*" --exclude "isos" /data/ks/
rsync://${slave}/ks/
	fi
done


-- 
“Don't eat anything you've ever seen advertised on TV”
         - Michael Pollan, author of "In Defense of Food"



More information about the CentOS mailing list