Hi, i am using rsync since years and i think it's one of the must-use tools. Great! Today i got my first problem after years of usage and the fantastic manpage doesn't give me any answer, neither the web does. I am starting with two directory "foo" and "bar" with a text file "test.txt" in each of it. "foo" and "bar" and "test.txt" belongs to different owners. -rw-r--r-- 1 janning janning 12 bar/test.txt -rw-r--r-- 1 postgres postgres 6 foo/test.txt Now i want to sync the content of test.txt WITHOUT changing the ownership (group, permissions, timestamp etc) on destination file (bar/test.txt) I run rsync as root to get the permission to overwrite those files: # rsync bar/ foo/ Result: -rw-r--r-- 1 janning janning 12 bar/test.txt -rw-r--r-- 1 root root 12 foo/test.txt Content is synced but ownership is set to "root". Of course i know "--owner" to preserve the ownership. But this results in -rw-r--r-- 1 janning janning 12 bar/test.txt -rw-r--r-- 1 janning janning 12 foo/test.txt I need an option like "--preserve-ownership-on-destination", like "cp" it should only copy the file and not its attributes like owner/group/permissions Is it possible at all with rsync? Or did i miss something? kind regards Janning
On Thu, Oct 26, 2006 at 12:14:11PM +0200, Janning Vygen wrote:> I run rsync as root to get the permission to overwrite those files: > > # rsync bar/ foo/You'd need to use --inplace to avoid changing the current owner. This has the downside that the file is briefly in-transition between the old state and the new state (unlike the normal transfer, where the new takes the place of the old instantly), but programs like "cp" update files in this manner, so it usually doesn't cause a problem. ..wayne..