Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'd like to use rsync to regularly archive a local directory containing upwards of 4G of data, using a low-privileges user account on a remote machine that has write access to only the backup directory. I'd like to preserve the permissions, users, and groups from the local machine so that I can just rsync the files back to the local machine as-is to restore the backup.

The trouble is that as soon as the files are created on the remote machine with the permissions, users, and groups from the local machine, the remote account no longer has the permissions required to modify the remote files if necessary. Is there a way to give a particular user write permissions to the backup directory on the remote machine without actually touching the permissions of the files inside that directory?

share|improve this question
    
Assuming you aren't going to work directly on your backup, you might save yourself a good deal of trouble by just archiving a tarball. Differential creation would still let you just copy files modified or created after the previous backup. –  Eroen Jan 31 '12 at 18:39
    
@Eroen I have to transmit the backups over a relatively slow and costly (per GB) Internet connection, so differential updates to the backup are a requirement. I haven't tried tarballing the whole kaboodle as you say because I suspect it will consume more bandwidth than if I rsync the files directly. Can you comment on whether my suspicion is correct or not? –  Isaac Sutherland Jan 31 '12 at 19:13
    
Quite right, rsync can limit transmit to changed parts of modified files (it claims), while a differential tarball would copy the wholes of any modified files. –  Eroen Jan 31 '12 at 19:18
add comment

1 Answer

What you could do is to create a group on the remote machine which matches that of the files. But this will only give you access to the files that are group modifiable.

Another option is to create a dummy user on your remote host, to which only you will connect (using su), using the same UID as the local machine.

A third option is to quickly do a chown -R ${USER} /directory and revert that back; I am however not certain of whether rsync will pick the difference, which might make it consider that the files are different. You should experiment with this.

But generally speaking, a backup isn't meant to be modified :)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.