Home / Restrict rsync access over SSH

Restrict rsync access over SSH

The rsync package includes a restricted rsync script called rrsync, which is normally located in /usr/share/doc/rsync/support and allows you to restrict rsync.

Ensure that the rsync package is installed before looking for the rrsync script.

Yum install rsync


dnf install rsync

or you can also confirm rrsync presence by searching rsync files as follows.

rpm -ql rsync | grep rrsync

After that, the rrsync script can be extracted and placed in the user’s home directory, with executable rights.

cp $(rpm -ql rsync | grep rrsync) /home/$USER/
chmod u+x /home/$USER/rrsync

When this program is launched, the client device will utilize rsync -av -e ssh src/ sesrver:dir/ SSHD on the server will execute this program if the command option is defined in /.ssh/authorized keys of a particular user on the server. For instance:

command="rrsync logs/client" ssh-rsa GAAAB3NzaC1yc2EAAAABIwAAAIEAzGhEeNlPr...
command="rrsync -ro results" ssh-rsa GAAAB3NzaC1yc2EAAAABIwAAAIEAmkHG1WCjC...

Viewing the script with your preferred text editor will reveal further details and instructions.

Leave a Reply