Ownership
Paul Haas
paulh at hamjudo.com
Thu Sep 9 14:04:38 GMT 2004
On Wed, 8 Sep 2004, Wayne Davison wrote:
> On Wed, Sep 08, 2004 at 04:52:51PM -0400, Paul Haas wrote:
>> I can think of 4 usefull modes:
>> 1 The default, don't try to chown().
>> 2 --owner If rsync thinks it is root, then try to chown()
>> 3 --owner-whining Always try to chown() and whine if it doesn't work.
>> 4 --owner-no-whining Always try to chown(), don't whine if it doesn't work.
> Here's a patch that adds mode 3 to the two existing modes (leaving mode
> 4 unimplemented for now). It forces the user to specify -oo to perform
> chowing even when not root (-ao is not enough), and to specify -gg to
> try to preserve all groups when not root (even if the group wasn't
> returned by the getgroups() call). For example:
> rsync -avoogg /src/ host:/dest
> This only works if both sides have this patch applied (otherwise the
> normal -o and -g behavior would apply).
> Thoughts?
It looks good to me.
You might want to add something like:
--- options.c 2004-09-09 09:20:20.000000000 -0400
+++ options.c.new 2004-09-09 09:17:17.000000000 -0400
@@ -250,7 +250,9 @@
rprintf(F," -H, --hard-links preserve hard links\n");
rprintf(F," -p, --perms preserve permissions\n");
rprintf(F," -o, --owner preserve owner (root only)\n");
+ rprintf(F," -oo attempt to preserve owner (even if not root)\n");
rprintf(F," -g, --group preserve group\n");
+ rprintf(F," -gg attempt to preserve group (even if not root)\n");
rprintf(F," -D, --devices preserve devices (root only)\n");
rprintf(F," -t, --times preserve times\n");
rprintf(F," -S, --sparse handle sparse files efficiently\n");
Note: In a contrived test, rsync didn't do a chmod() after a chown()
failed. So those files were left with the mode of the temporary file. I
can't think of a real world situation where that matters.
Now the stage is set for someone to create a filesystem with semantics
that are designed for rsync. rsync wouldn't need to run as root on the
system that holds the backups. FUSE, filesystem in userspace, is a good
place to start. See http://lwn.net/Articles/68104 for a description.
Note that an early version of FUSE had a "bug" such that any user could
chown. Just call it a feature.
> .. wayne..
--
Paul Haas
paulh at hamjudo.com
More information about the rsync
mailing list