Implement the "m", "o", "g" include modifiers to tweak the permissions,
[rsync/rsync.git] / rsync.yo
index 60c6ea8..5fbe868 100644 (file)
--- a/rsync.yo
+++ b/rsync.yo
@@ -1028,6 +1028,8 @@ quote(--chmod=Dg+s,ug+w,Fo-w,+X)
 
 It is also legal to specify multiple bf(--chmod) options, as each
 additional option is just appended to the list of changes to make.
+To change permissions of files matching a pattern, use an include filter with
+the bf(m) modifier, which takes effect before any bf(--chmod) options.
 
 See the bf(--perms) and bf(--executability) options for how the resulting
 permission value can be applied to the files in the transfer.
@@ -1808,6 +1810,10 @@ be omitted, but if USER is empty, a leading colon must be supplied.
 If you specify "--chown=foo:bar, this is exactly the same as specifying
 "--usermap=*:foo --groupmap=*:bar", only easier.
 
+To change ownership of files matching a pattern, use an include filter with
+the bf(o) and bf(g) modifiers, which take effect before uid/gid mapping and
+therefore em(can) be mixed with bf(--usermap) and bf(--groupmap).
+
 dit(bf(--timeout=TIMEOUT)) This option allows you to set a maximum I/O
 timeout in seconds. If no data is transferred for the specified time
 then rsync will exit. The default is 0, which means no timeout.
@@ -2620,6 +2626,15 @@ itemization(
   option's default rules that exclude things like "CVS" and "*.o" are
   marked as perishable, and will not prevent a directory that was removed
   on the source from being deleted on the destination.
+  it() An bf(m+nop()(CHMOD)) on an include rule tweaks the permissions of matching
+  source files in the same way as bf(--chmod).  This happens before any
+  tweaks requested via bf(--chmod) options.
+  it() An bf(o+nop()(USER)) on an include rule pretends that matching source files
+  are owned by bf(USER) (a name or numeric uid).  This happens before any uid
+  mapping by name or bf(--usermap).
+  it() A bf(g+nop()(GROUP)) on an include rule pretends that matching source files
+  are owned by bf(GROUP) (a name or numeric gid).  This happens before any gid
+  mapping by name or bf(--groupmap).
 )
 
 manpagesection(MERGE-FILE FILTER RULES)
@@ -2681,6 +2696,12 @@ itemization(
   a rule prefix such as bf(hide)).
 )
 
+The attribute-affecting modifiers bf(m), bf(o), and bf(g) work only in client
+filters (not in daemon filters), and only the modifiers of the first matching
+rule are applied.  As an example, assuming bf(--super) is enabled, the
+rule "+o+nop()(root)g+nop()(root)m+nop()(go=) *~" would ensure that all "backup" files belong to
+root and are not accessible to anyone else.
+
 Per-directory rules are inherited in all subdirectories of the directory
 where the merge-file was found unless the 'n' modifier was used.  Each
 subdirectory's rules are prefixed to the inherited per-directory rules