I have two computers with the same user, me@Home and me@Work. I usually kept their folders synced by bringing Work home (it's a laptop) and rsyncing over LAN. However, now I'm not bringing Work home anymore, so I started using the uni's ssh server to keep my computers synced.

me@Work -> my_name@Uni
me@Home <- my_name@Uni

However, when rsyncing from Work to Uni, using -avuz, which should preserve ownership, file ownership is lost. I made some tests and the issue seems to be the unmatched "me" user at Uni. Not only that, directories owned by www-data also didn't have their ownership preserved (since there isn't such user at Uni either), which, one can imagine, caused me some trouble. I don't have root access at Uni nor can my username be changed. Is there anyway I can make this work without setting up a ssh server myself or start bringing Work home again?

  • Not that I tried this, but does --numeric-ids make a difference? – tink Aug 12 '14 at 2:58
  • 1
    Clarify "lost" -- you can't create a file with arbitrary ownership unless superuser on the remote side (uni), so I assume those files show my_name as the user? – Ulrich Schwarz Aug 12 '14 at 5:58
  • @UlrichSchwarz Exactly. my_name owns all files after they've been rsynced to Uni. @tink That did not made any difference. – Alex Aug 12 '14 at 19:31
  • 1
    You can't do it. As @UlrichSchwarz said, only the superuser is allowed to set file ownership. When ordinary users create files, they are always owned by that user, and they can't change it. – Barmar Aug 12 '14 at 21:20
  • 1
    The only thing I can think of is to write a tar file instead of using rsync. – Barmar Aug 12 '14 at 21:22

rsync can't preserve ownership if it's being run by a non-root user on the destination system, because only the superuser is allowed to create files that are owned by someone else. Instead of using rsync create a tar file on the intermediate system. Then when you restore it on the ultimate target system, you can do so as root in order to give the original ownership to the files.


the ownership is preserved, but probably you dont have the same users in both enviroments. check the user id of by example user www-data in both servers and compare it.

you may see another name, but the id will be the same

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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