rsync-2.5.6

Introduction to rsync

The rsync package contains the rsync utility. This is useful for synchronizing large file archives over a network.

Package information

Installation of rsync

For security reasons, running rsync server as an unprivileged user and group is encouraged.

groupadd rsyncd &&
useradd -c rsyncd -d /home/rsync -g rsyncd -s /bin/false rsyncd

Install rsync by running the following commands:

./configure --prefix=/usr &&
make &&
make install 

Command explanations

--prefix=/usr : This installs rsync in /usr instead of /usr/local

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 authentication).

cat > /etc/rsyncd.conf << "EOF"
# This is a basic rsync configuration file
# It exports a single module without user authentication.

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 rsync daemon 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

Contents

The rsync package contains rsync.

Description

rsync

rsync is a replacement for rcp (and scp) that has many more features. It uses the "rsync algorithm" which provides a very fast method for remote files into sync. It does this by sending just the differences in the files across the link, without requiring that both sets of files are present at one of the ends of the link beforehand.