Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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
up vote 0 down vote accepted

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.

share|improve this answer

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.

share|improve this answer
You wouldn't be able to create this user as root already has that UID. – jackweirdy Sep 12 '12 at 18:58
@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

You must log in to answer this question.