Ownership and permissions when syncing directory contents

Paul Slootman paul+rsync at wurtel.net
Fri Jan 20 10:36:16 UTC 2017


On Fri 20 Jan 2017, John Lane wrote:
> 
> When you rsync a directory, say `$rsync mydir/ ...` with the trailing
> slash, the destination directory is changed to the ownership,
> permissions and timestamp of `mydir`.

>     $ rsync -a a/ b/ c
>     $ ls -ld c
>     drwxr-xr-x 2 john users 4096 Jun 15  1985 c
> 
> The directory 'c' now has the timestamp of the file 'a'
> 
> Furthermore, if the copy is done with root, the ownership and
> permissions of the file are also propagated to the directory. Note the
> destination directory gains the properties of the first source directory
> with a trailing slash.

That is as documented. You are requesting that the directory is synced
to c, preserving all attributes (due to -a) so rsync does that.


Paul



More information about the rsync mailing list