Configuring rsync
Config files
/etc/rsyncd.conf
This is a simple download-only configuration. See the rsyncd man-page for
additional options (i.e. user authentification).
cat > /etc/rsyncd.conf << "EOF"
# This is a basic rsync configuration file
# It exports a single module without user authentification.
motd file = /home/rsync/welcome.msg
use chroot = yes
[localhost]
path = /home/rsync
comment = Default rsync module
read only = yes
list = yes
uid = rsyncd
gid = rsyncd
EOF
rsyncd init.d script
Note that you only want to start the rsync
server if you want to provide a rsync archive on
your machine. The rsync client doesn't need this
script to be used. Having said that, if you want to run the rsync
daemon, the rsyncd init.d script can be
created using the following commands:
cat > /etc/rc.d/init.d/rsyncd << "EOF"
#!/bin/sh
# Begin $rc_base/init.d/rsyncd
# Based on sysklogd script from LFS-3.1 and earlier.
# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org
source /etc/sysconfig/rc
source $rc_functions
case "$1" in
start)
echo "Starting RSYNC Server..."
loadproc /usr/bin/rsync --daemon --compress
;;
stop)
echo "Stopping RSYNC Server..."
killproc /usr/bin/rsync
;;
reload)
echo "Reloading RSYNC Server..."
reloadproc /usr/bin/rsync
;;
restart)
$0 stop
sleep 1
$0 start
;;
status)
statusproc /usr/bin/rsync
;;
*)
echo "Usage: $0 {start|stop|reload|restart|status}"
exit 1
;;
esac
# End $rc_base/init.d/rsyncd
EOF
chmod 755 /etc/rc.d/init.d/rsyncd
Create the symbolic links to this file in the relevant
rc.d directories with the following
commands:
cd /etc/rc.d/init.d &&
ln -sf ../init.d/rsyncd ../rc0.d/K30rsyncd &&
ln -sf ../init.d/rsyncd ../rc1.d/K30rsyncd &&
ln -sf ../init.d/rsyncd ../rc2.d/K30rsyncd &&
ln -sf ../init.d/rsyncd ../rc3.d/S30rsyncd &&
ln -sf ../init.d/rsyncd ../rc4.d/S30rsyncd &&
ln -sf ../init.d/rsyncd ../rc5.d/S30rsyncd &&
ln -sf ../init.d/rsyncd ../rc6.d/K30rsyncd