I'm trying to create an automated back up of various folders on my server, some of these require root access to read them. I realise that I can rsync as per this answer, namely I can (with success) do
rsync ... --rsync-path="sudo rsync" ...
However, this solution means that I have to add a public ssh-key to a user that has sudo rights (or at least sudo rights to use rsync). Since rsync is such a powerful tool, I would like to add more protection by either
- adding a passphrase to the private ssh-key, or
- limiting what actions that user can do via rsync.
The former is not really possible with an automated back up. And it seems that "rrsync" is geared up to do the latter, see here.
However, I'm having problems with accessing folders that require root access using rrsync. I followed the above rrsync tutorial, and set up rrsync on the remote server in ~/.ssh/authorized_keys
by prepending the key with
command="/path/to/rrsync -ro /path/to/backups/"
and then attempting to locally run
rsync ... --rsync-path="sudo rsync" ...
then rrsync throws an error. Namely:
/path/to/rrsync: SSH_ORIGINAL_COMMAND='sudo /usr/bin/rsync --server --sender ...' is not rsync
Therefore, my understanding is that rrsync does not allow one to use "sudo rsync" with it. Is this a shortcoming of rrsync or intentional? Or is there another way that I can achieve what I'm trying to do?