Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to use rsync (as a user) from "me" on a local computer to "another" user on a distant computer. However, I also want "another" user (on the distant computer) to own the files and to be able to use them exactly as "me" (on the local computer).

I believe I shall play with the options: -p (preserve permissions), -g (preserve groups) and -o (preserve ownership), but I'm not sure of the exact effect of those. Which one(s) shall I impose ?

share|improve this question
add comment

1 Answer

Your answer can be found in the rsync manpage, under the -p, --perms option:

Thus, when --perms and --executability are both disabled, rsync’s behavior is the same as that of other file-copy utilities, such as cp(1) and tar(1).

Which looks like what you want, you're on the right track. I suggest you read the entire section in the manpage to get the full view of what these options offer.

You can disable an option using the --no-OPTION syntax, so disabling permissions would be:

rsync -a --no-perms --no-group /source /target

You can set it up as an alias in ~/.bashrc (for Ubuntu IIRC) to make typing easier:

alias rsync-cp='rsync -a --no-perms --no-group --progress'

and just call rsync-cp instead of rsync to use those options. I included --progress too to show rsync progress bars.

share|improve this answer
    
Thanks for the quick answer. So, if I rsync files to the /home of "another" user (--no-perms --no-group), will other users be able to see/exec those files or is it only "anoter" user ??? –  jobeda Sep 19 '11 at 20:50
    
However, keep in mind that if you sync to another system, the uid's might differ. As in user "joe" on your system could be user "jake" on the other. That is if there is an user with the ID at all. –  Straphka Sep 20 '11 at 9:39
    
By using the options above, rsync acts like normal copy, and the new files will inherit the destination user's permissions, like that user now owns the files, can see, edit and exec them as they are his/her own. Try a few files to test and see if results are what you expect. –  invert Sep 20 '11 at 18:42
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.