rsync ownership oddity - bug or feature?

Karl Auer kauer at biplane.com.au
Wed Apr 20 22:51:32 UTC 2022


On Thu, 2022-04-21 at 07:51 +1000, Karl Auer wrote:
> It all works exactly as expected except that afterwards, /destination
> is owned by fred:fred.
> 
> Why?!? And is there anything I can do in the rsync command to stop
> this behaviour?

Sigh. I read the man page (again) and found this:

'A trailing slash on the source changes this behavior to avoid creating
an additional directory level at the destination.  You can think of a
trailing / on a source as meaning "copy the contents of this directory"
as opposed to "copy the directory by name", but in both cases the
attributes of the containing directory are transferred to the
containing directory on the destination.'

I still find this behaviour wrong, but at least it's a known thing. I
imagine that since it's been that way forever, it is not going to
change any time soon.

Out of interest I tried this:

   rsync -a /source/* /destination

...and that worked without changing the ownership on /destination.
Unfortunately, this does not catch hidden files, so it's not really a
useful equivalent.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer

GPG fingerprint: 61A0 99A9 8823 3A75 871E 5D90 BADB B237 260C 9C58
Old fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170







More information about the ubuntu-users mailing list