Chrooting openrsync

This guide explains how to provide users with rsync confined inside a chroot.

This guide assumes you have configured sshd to chroot the user.

Copying openrsync inside chroot

openrsync and a few dependencies need to be copied inside the chroot:

# mkdir -p /home/$USER/usr/bin/
# cp /usr/bin/openrsync /home/$USER/usr/bin/
# mkdir -p /home/$USER/usr/lib/
# cp /usr/lib/{libcrypto.so.*,libm.so.*,libutil.so.*,libc.so.*} /home/$USER/usr/lib/
# mkdir -p /home/$USER/usr/libexec/
# cp /usr/libexec/ld.so /home/$USER/usr/libexec/

We create a hard link to work with clients that expect rsync:

# ln /home/$USER/usr/bin/openrsync /home/$USER/usr/bin/rsync

Replace $USER with the actual username.