Implement the "m", "o", "g" include modifiers to tweak the permissions,
[rsync/rsync.git] / rsync.yo
index 8d6aba3..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.
@@ -2457,15 +2463,15 @@ must come after either a single space or an underscore (_).
 Here are the available rule prefixes:
 
 quote(
-bf(exclude, -) specifies an exclude pattern. nl()
-bf(include, +) specifies an include pattern. nl()
-bf(merge, .) specifies a merge-file to read for more rules. nl()
-bf(dir-merge, :) specifies a per-directory merge-file. nl()
-bf(hide, H) specifies a pattern for hiding files from the transfer. nl()
-bf(show, S) files that match the pattern are not hidden. nl()
-bf(protect, P) specifies a pattern for protecting files from deletion. nl()
-bf(risk, R) files that match the pattern are not protected. nl()
-bf(clear, !) clears the current include/exclude list (takes no arg) nl()
+bf(exclude, -) Exclude matching files. nl()
+bf(include, +) Don't exclude matching files. nl()
+bf(merge, .) Read a merge-file for more rules. nl()
+bf(dir-merge, :) Specify a per-directory merge-file. nl()
+bf(hide, H) Hide matching source files from the transfer (shorthand for bf(-s)). nl()
+bf(show, S) Do not hide matching source files from the transfer (shorthand for bf(+s)). nl()
+bf(protect, P) Protect matching destination files from deletion (shorthand for bf(-r)). nl()
+bf(risk, R) Do not protect matching destination files from deletion (shorthand for bf(+r)). nl()
+bf(clear, !) Clear the current include/exclude list (takes no argument). nl()
 )
 
 When rules are being read from a file, empty lines are ignored, as are
@@ -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