feature request: "remote user is root, make remote owner is foo"

travis+ml-rsync at subspacefield.org travis+ml-rsync at subspacefield.org
Wed Aug 11 15:51:35 MDT 2010


On Wed, Aug 11, 2010 at 01:32:42PM -0400, Brian Cuttler wrote:
[Set u+s on directories, don't worry about owners]

It seems to work relatively well.  I get an error about not being
able to chgrp the files owned by other users, and, in my case,
the group ends up wrong because it's not supposed to be the same
on both ends (www-data on destination, something else on source).

However, because of the former problem, at least the extant files
stay readable until I can fix-up the group problem caused by the
latter.  If I further chown them to www-data, then they don't get
their gid hosed the second time around.

Not an ideal solution, but seems workable for the time being.

Aside: chown really needs a flag that says "set GID on directories but
nothing else".  Right now I do this, which is the only right thing to
do when filenames might contain anything, including whitespace or
newlines:

setperms () {
   local perms="$1"
   local fileperm="$2"
   local dirperm="$3"
   local own="$4"

   local dir

   shift 4

   for dir in "$@"
   do
     if test -d "$dir"
     then
       find "$dir" -xdev -type d -print0 | xargs -0 --no-run-if-empty chmod "$perms","$dirperm" --
       find "$dir" -xdev -type f -print0 | xargs -0 --no-run-if-empty chmod "$perms","$fileperm" --
       chown -R "$own" "$dir"
     fi
   done
}

setperms u=rwX,o=rX g=rwX g=rwxs owner:group /path/to/whatever
-- 
A Weapon of Mass Construction
My emails do not have attachments; it's a digital signature that your mail
program doesn't understand. | http://www.subspacefield.org/~travis/ 
If you are a spammer, please email john at subspacefield.org to get blacklisted.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/rsync/attachments/20100811/085c11cb/attachment.pgp>


More information about the rsync mailing list