1

I would like to know how to sync directories with same owner, timestamp, group etc

I tried below but it ask for my password and respective files/directories will be copied with my name. Please suggest on this.

rsync -avz /home/duser/p server2:/home/duser/
Ashu
  • 115
  • Generally, non-root cannot create files owned by another user. https://unix.stackexchange.com/questions/27350/why-cant-a-normal-user-chown-a-file – BowlOfRed Nov 08 '18 at 06:01

1 Answers1

1

As with the chown utility, you can not "give away" ownership of files, and neither can you "grab ownership" of files that you don't own, unless you are root.

To be able to preserve ownership and group ownerships on files and directories that you copy with rsync, you will have to do it as the root user.

Kusalananda
  • 333,661