How to keep owner on destination file

Janning Vygen vygen at
Fri Oct 27 14:29:26 GMT 2006

Am Donnerstag, 26. Oktober 2006 17:36 schrieb Wayne Davison:
> 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.

Thanks a lot for this hint. It should be mentioned in the manpage, where 
scenarios for --inplace are discribed and should be mentioned with the 
option --owner, too. like this:

   If you do not set --owner neither --inplace the owner of the destination 
   file becomes the user running rsync.

What i don't understand: why it only preserves ownership on destination files 
if --inplace is given? Without --inplace and without --owner i would expect 
rsync to do something like

  scp bar/test.txt foo/
  chown --reference=foo/test.txt foo/
  mv foo/ foo/test.txt

IMHO you can achieve atomic file replacement and preserving ownership on 
destination file.

but --inplace works perfectly for my purpose.

kind regards

More information about the rsync mailing list