I have access to 2 group accounts: ops_user and test_user. Is it possible to copy a directory and all subdirectory owned by ops_user to a new directory owned by the test_user? I.e I want to copy everything from /blah/Blah/ops (owned by ops-user) to /blah/Blah/test (and have it owned by test_user). I've tried the following.

Logged in as test_user in /blah/Blah/test:

 rsync -avz */ ops_user@boco2:/blah/Blah/ops --owner=test_user --group=user 
 rsync -avzh ops_user@boco2:/blah/Blah/ops /blah/Blah/test/
 rsync -avz */ ops_user@boco2:/blah/Blah/ops
 rsync -avzhe ssh ops_user@boco2:/blah/Blah/ops /blah/Blah/test

Logged in as ops_user in /blah/Blah/ops:

'rsync -avz */ test_user@oco2:/blah/Blah/test'

None of these work. I read the man for rsync, but just can not figure this out. I do not have SA perms to change group owners, but thought I could copy and add test perms. Is rsync even what I should be using? Any suggestions would be greatly appreciated.

  • 1
    If test_user is not root, any copy he makes should end up with his user. Can you post the output of ls -l of a file from the rsync to see what is happening?
    – casey
    Dec 5, 2013 at 22:54

1 Answer 1


If the contents of /blah/Blah/ops/ are public (that is, you can access them while logged in as test_user), then you can use a purely local rsync:

rsync -rltpDv /blah/Blah/ops/ /blah/Blah/test/

Note: the / after ops is important. (If you leave it off, then rsync will copy the ops directory itself into the test directory in addition to its contents.)

If the contents are not currently public, you could make them public (as ops_user) just temporarily for the purposes of copying:

chmod -R go+rX /blah/Blah/ops

and then try the above rsync again.

If you can't make them public, then the rsync-over-ssh approach as test_user should work:

rsync -rltpDv ops_user@host:/blah/Blah/ops/ /blah/Blah/test/

although you may need to specify the ssh remote shell explicitly with -e ssh. If this command doesn't work, what error message do you see?

  • The / after ops makes a difference, but saying it's "important" makes it sound like it's definitely wanted. It may or may not be wanted. I didn't see enough in the orig question to settle that.
    – dubiousjim
    Dec 5, 2013 at 23:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .