I'd like to use rsync to regularly backup content from a production website to a backup server. The content being transferred from the remote system has a variety of permissions and owners assigned. Do I need to use root to do this? Is there a way to assign another user with elevated privileges for this task?

Update: Both machines are running Ubuntu 12.04 Server.

  • You forgot to mention which OS you're using. Generally root will be required, but some OS's are different. – Cry Havok Sep 12 '12 at 16:04

Another option, if you want to avoid allowing remote login for someone with UID 0, might be something like this:

  • stage the backup of the remote host in a local directory on that remote host (as root)
  • still as root, add an ACL to grant an (unprivileged) backup user access to everything inside that backup directory (setfacl -R -m u:backup:rwx /PATH/TO/staging_dir)
  • as the backup user rsync the backup directory to your local computer (rsync -aH REMOTE:/PATH/TO/staging_dir /LOCAL/backup_dir)
  • remove the contents of the staging directory

Disadvantage of this approach is that you have to coordinate the staging on the remote host and the rsync on your local computer. You could have the remote backup script create a marker in the backup user's home directory after the staging is complete, and have the rsync script remove the marker after the synchronization is finished.


You could create a user with a uid of 0. That means privileges equivalent to user root, but using a different name. While it is just another 'root' account, it provides some way of security by obscurity (not real security).

To do this, force useradd with the option --non-unique option, otherwise it prevents you to create a user sharing the uid.

  • You wouldn't be able to create this user as root already has that UID. – jackweirdy Sep 12 '12 at 18:58
  • 1
    @jackweirdy You can. See the manpage of useradd. I've updated my answer accordingly. – gertvdijk Sep 12 '12 at 19:05
  • I stand corrected! :) Still probably a bad idea from a security perspective though as its using the root user privileges – jackweirdy Sep 12 '12 at 22:06

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy