Rsync "sync then chown/chgrp" feature
dwd at bell-labs.com
Fri Oct 12 03:11:44 EST 2001
On Wed, Oct 10, 2001 at 07:51:58PM -0700, Doug wrote:
> the attached patch adds the "synchronize these files and then chown/chgrp
> them to a specified user/group, no matter who owns the originals" feature.
> the relevant usage lines are now:
> -o, --owner preserve owner (root only)
> -o, --owner=OWNER specify owner (root only)
> -g, --group preserve group
> -g, --group=GROUP specify group
> with this patch, the feature works locally but not remotely.
> in options.c:server_options(), i've added code to pass args on to the
> server, but i don't think i'm doing it correctly. if anyone would
> be willing to take a look and see what they think is happening, i'd
> be grateful. other comments/nitpicks also welcome.
My first reaction to this is that it isn't necessary because root can
just su to another user before installing, but then I remembered that
cpio has a "-R id" option to assign a different user id and owner for
convenience. Maybe going that route would be better, and it is handy
sometimes for root, especially when copying locally. Oh, I see that GNU
cpio has a long name equivalent of --owner for -R, and allows setting the
group separately with the syntax of OWNER:GROUP or OWNER.GROUP. So maybe
Doug's suggestion is fine. I would suggest that if the owner is specified
but the group isn't then it should default to the owner's group in the
password file rather than preserving the original group.
- Dave Dykstra
More information about the rsync