Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I´m trying to set owner and group via rsync and it doesn't seem to be working.

This is the command:

sudo rsync -rlptDvz --owner=cmsseren --group=cmsseren /home/serena/public_html/ -e ssh root@ip:/home/cmsseren/public_html2/

The files sync correctly but doesn´t seem to change the owner and group.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

It sounds like it is working correctly. Use --owner and --group to preserve (not set) the owner and group names... meaning that you do not want them to change after the transfer.

If you don't use these options, the user and group will be changed to the invoking user on the receiving end. If you want to specify some other user, you will need to add a chown command to your script.

-o, --owner
    This option causes rsync to set the owner of the destination file to be 
    the same as  the source file, but only if the receiving rsync is being run 
    as the super-user (see also the --super and --fake-super options). Without 
    this option, the owner of new and/or transferred files are set to the invoking 
    user on the receiving side...

-g, --group
    This option causes rsync to set the group of the destination file to be the same as 
    the source file. If the receiving program is not running as the super-user (or if
    --no-super was specified), only groups that the invoking user on the receiving side
    is a member of will be preserved. Without this option, the group is set to the default
    group of the invoking user on the receiving side...

man rsync

share|improve this answer
    
So how can I chown user and group remotly? Via ssh? Could you please tell me how? I have root acces for both servers. I don´t want to use ssh keys, but tell me all options you know, I´ll appreciate it. Thanks for quick response –  Arnoldo Bazaldua Dec 31 '13 at 21:30
    
The command would look something like this: ssh root@ip 'chown -R cmsseren:cmsseren /home/serena/public_html2/*' –  user3150166 Dec 31 '13 at 21:45
    
I tried it, but didn´t work, the owners and users are the same. After making the command it says: stdin: is not a tty –  Arnoldo Bazaldua Jan 2 at 17:26
    
It works now, firewall issues. Now I just have to automatize the password input for ssh and rsync –  Arnoldo Bazaldua Jan 2 at 18:16
    
I´ll post this in otherquestion, thanks for your help –  Arnoldo Bazaldua Jan 2 at 18:51

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.