- Renamed set_perms() to set_file_attrs().
[rsync/rsync.git] / rsync.yo
index 2453ee3..087912b 100644 (file)
--- a/rsync.yo
+++ b/rsync.yo
@@ -36,7 +36,7 @@ itemize(
   it() exclude and exclude-from options similar to GNU tar
   it() a CVS exclude mode for ignoring the same files that CVS would ignore
   it() can use any transparent remote shell, including ssh or rsh
-  it() does not require root privileges
+  it() does not require super-user privileges
   it() pipelining of file transfers to minimize latency costs
   it() support for anonymous or authenticated rsync daemons (ideal for
        mirroring)
@@ -316,11 +316,14 @@ to the detailed description below for a complete description.  verb(
  -H, --hard-links            preserve hard links
  -K, --keep-dirlinks         treat symlinked dir on receiver as dir
  -p, --perms                 preserve permissions
- -o, --owner                 preserve owner (root only)
+ -o, --owner                 preserve owner (super-user only)
  -g, --group                 preserve group
- -D, --devices               preserve devices (root only)
+     --devices               preserve device files (super-user only)
+     --specials              preserve special files
+ -D                          same as --devices --specials
  -t, --times                 preserve times
  -O, --omit-dir-times        omit directories when preserving times
+     --super                 receiver attempts super-user activities
      --chmod=CHMOD           change destination permissions
  -S, --sparse                handle sparse files efficiently
  -n, --dry-run               show what would have been transferred
@@ -346,6 +349,7 @@ to the detailed description below for a complete description.  verb(
      --partial               keep partially transferred files
      --partial-dir=DIR       put a partially transferred file into DIR
      --delay-updates         put all updated files into place at end
+ -m, --prune-empty-dirs      prune empty directory chains from file-list
      --numeric-ids           don't map uid/gid values by user/group name
      --timeout=TIME          set I/O timeout in seconds
  -I, --ignore-times          don't skip files that match size and time
@@ -370,6 +374,7 @@ to the detailed description below for a complete description.  verb(
  -0, --from0                 all *from/filter files are delimited by 0s
      --address=ADDRESS       bind address for outgoing socket to daemon
      --port=PORT             specify double-colon alternate port number
+     --sockopts=OPTIONS      specify custom TCP options
      --blocking-io           use blocking I/O for the remote shell
      --stats                 give some file-transfer stats
  -h, --human-readable        output numbers in a human-readable format
@@ -399,6 +404,7 @@ accepted: verb(
      --config=FILE           specify alternate rsyncd.conf file
      --no-detach             do not detach from the parent
      --port=PORT             listen on alternate port number
+     --sockopts=OPTIONS      specify custom TCP options
  -v, --verbose               increase verbosity
  -4, --ipv4                  prefer IPv4
  -6, --ipv6                  prefer IPv6
@@ -682,21 +688,30 @@ umask setting
 (which is the same behavior as other file-copy utilities, such as cp).
 
 dit(bf(-o, --owner)) This option causes rsync to set the owner of the
-destination file to be the same as the source file.  On most systems,
-only the super-user can set file ownership.  By default, the preservation
-is done by name, but may fall back to using the ID number in some
-circumstances.  See the bf(--numeric-ids) option for a full discussion.
+destination file to be the same as the source file.  By default, the
+preservation is done by name, but may fall back to using the ID number
+in some circumstances (see the bf(--numeric-ids) option for a full
+discussion).
+This option has no effect if the receiving rsync is not run as the
+super-user and bf(--super) is not specified.
 
 dit(bf(-g, --group)) This option causes rsync to set the group of the
 destination file to be the same as the source file.  If the receiving
-program is not running as the super-user, only groups that the
+program is not running as the super-user (or with the bf(--no-super)
+option), only groups that the
 receiver is a member of will be preserved.  By default, the preservation
 is done by name, but may fall back to using the ID number in some
 circumstances.  See the bf(--numeric-ids) option for a full discussion.
 
-dit(bf(-D, --devices)) This option causes rsync to transfer character and
-block device information to the remote system to recreate these
-devices. This option is only available to the super-user.
+dit(bf(--devices)) This option causes rsync to transfer character and
+block device files to the remote system to recreate these devices.
+This option has no effect if the receiving rsync is not run as the
+super-user and bf(--super) is not specified.
+
+dit(bf(--specials)) This option causes rsync to transfer special files
+such as named sockets and fifos.
+
+dit(bf(-D)) The bf(-D) option is equivalent to bf(--devices) bf(--specials).
 
 dit(bf(-t, --times)) This tells rsync to transfer modification times along
 with the files and update them on the remote system.  Note that if this
@@ -711,7 +726,17 @@ it is preserving modification times (see bf(--times)).  If NFS is sharing
 the directories on the receiving side, it is a good idea to use bf(-O).
 This option is inferred if you use bf(--backup) without bf(--backup-dir).
 
-dit(bf(--chmod)) This options tells rsync to apply the listed "chmod" pattern
+dit(bf(--super)) This tells the receiving side to attempt super-user
+activities even if the receiving rsync wasn't run by the super-user.  These
+activities include: preserving users via the bf(--owner) option, preserving
+all groups (not just the current user's groups) via the bf(--groups)
+option, and copying devices via the bf(--devices) option.  This is useful
+for systems that allow such activities without being the super-user, and
+also for ensuring that you will get errors if the receiving side isn't
+being running as the super-user.  To turn off super-user activities, the
+super-user can use bf(--no-super).
+
+dit(bf(--chmod)) This option tells rsync to apply the listed "chmod" pattern
 to the permission of the files on the destination.  In addition to the normal
 parsing rules specified in the chmod manpage, you can specify an item that
 should only apply to a directory by prefixing it with a 'D', or specify an
@@ -829,7 +854,7 @@ See bf(--delete) (which is implied) for more details on file-deletion.
 dit(bf(--ignore-errors)) Tells bf(--delete) to go ahead and delete files
 even when there are I/O errors.
 
-dit(bf(--force)) This options tells rsync to delete directories even if
+dit(bf(--force)) This option tells rsync to delete directories even if
 they are not empty when they are to be replaced by non-directories.  This
 is only relevant without bf(--delete) because deletions are now done depth-first.
 Requires the bf(--recursive) option (which is implied by bf(-a)) to have any effect.
@@ -1117,9 +1142,9 @@ If em(DIR) is a relative path, it is relative to the destination directory.
 See also bf(--compare-dest) and bf(--copy-dest).
 
 Note that rsync versions prior to 2.6.1 had a bug that could prevent
-bf(--link-dest) from working properly for a non-root user when bf(-o) was specified
-(or implied by bf(-a)).  You can work-around this bug by avoiding the bf(-o) option
-when sending to an old rsync.
+bf(--link-dest) from working properly for a non-super-user when bf(-o) was
+specified (or implied by bf(-a)).  You can work-around this bug by avoiding
+the bf(-o) option when sending to an old rsync.
 
 dit(bf(-z, --compress)) With this option, rsync compresses the file data
 as it is sent to the destination machine, which reduces the amount of data
@@ -1165,6 +1190,15 @@ double-colon (::) syntax to connect with an rsync daemon (since the URL
 syntax has a way to specify the port as a part of the URL).  See also this
 option in the bf(--daemon) mode section.
 
+dit(bf(--sockopts)) This option can provide endless fun for people
+who like to tune their systems to the utmost degree. You can set all
+sorts of socket options which may make transfers faster (or
+slower!). Read the man page for the setsockopt() system call for
+details on some of the options you may be able to set. By default no
+special socket options are set. This only affects direct socket
+connections to a remote rsync daemon.  This option also exists in the
+bf(--daemon) mode section.
+
 dit(bf(--blocking-io)) This tells rsync to use blocking I/O when launching
 a remote shell transport.  If the remote shell is either rsh or remsh,
 rsync defaults to using
@@ -1180,7 +1214,7 @@ with older versions of rsync, but that also turns on the output of other
 verbose messages).
 
 The "%i" escape has a cryptic output that is 9 letters long.  The general
-format is like the string bf(UXcstpoga)), where bf(U) is replaced by the
+format is like the string bf(UXcstpog)), where bf(U) is replaced by the
 kind of update being done, bf(X) is replaced by the file-type, and the
 other letters represent attributes that may be output if they are being
 modified.
@@ -1201,7 +1235,8 @@ quote(itemize(
 ))
 
 The file-types that replace the bf(X) are: bf(f) for a file, a bf(d) for a
-directory, an bf(L) for a symlink, and a bf(D) for a device.
+directory, an bf(L) for a symlink, a bf(D) for a device, and a bf(S) for a
+special file (e.g. named sockets and fifos).
 
 The other letters in the string above are the actual letters that
 will be output if the associated attribute for the item is being updated or
@@ -1225,11 +1260,9 @@ quote(itemize(
   it() A bf(p) means the permissions are different and are being updated to
   the sender's value (requires bf(--perms)).
   it() An bf(o) means the owner is different and is being updated to the
-  sender's value (requires bf(--owner) and root privileges).
+  sender's value (requires bf(--owner) and super-user privileges).
   it() A bf(g) means the group is different and is being updated to the
   sender's value (requires bf(--group) and the authority to set the group).
-  it() The bf(a) is reserved for a future enhanced version that supports
-  extended file attributes, such as ACLs.
 ))
 
 One other output is possible:  when deleting files, the "%i" will output
@@ -1353,6 +1386,36 @@ See also the "atomic-rsync" perl script in the "support" subdir for an
 update algorithm that is even more atomic (it uses bf(--link-dest) and a
 parallel hierarchy of files).
 
+dit(bf(-m, --prune-empty-dirs)) This option tells the receiving rsync to get
+rid of empty directories from the file-list, including nested directories
+that have no non-directory children.  This is useful for avoiding the
+creation of a bunch of useless directories when the sending rsync is
+recursively scanning a hierarchy of files using include/exclude/filter
+rules.
+
+Because the file-list is actually being pruned, this option also affects
+what directories get deleted when a delete is active.  However, keep in
+mind that excluded files and directories can prevent existing items from
+being deleted (because an exclude hides source files and protects
+destination files).
+
+You can prevent the pruning of certain empty directories from the file-list
+by using a global "protect" filter.  For instance, this option would ensure
+that the directory "emptydir" was kept in the file-list:
+
+quote(    --filter 'protect emptydir/')
+
+Here's an example that copies all .pdf files in a hierarchy, only creating
+the necessary destination directories to hold the .pdf files, and ensures
+that any superfluous files and directories in the destination are removed
+(note the hide filter of non-directories being used instead of an exclude):
+
+quote(     rsync -avm --del --include='*.pdf' -f 'hide! */' src/ dest)
+
+If you didn't want to remove superfluous destination files, the more
+time-honored options of "--include='*/' --exclude='*'" would work fine
+in place of the hide-filter (if that is more natural to you).
+
 dit(bf(--progress)) This option tells rsync to print information
 showing the progress of the transfer. This gives a bored user
 something to watch.
@@ -1486,7 +1549,7 @@ client version of this option (above) for some extra details.
 dit(bf(--config=FILE)) This specifies an alternate config file than
 the default.  This is only relevant when bf(--daemon) is specified.
 The default is /etc/rsyncd.conf unless the daemon is running over
-a remote shell program and the remote user is not root; in that case
+a remote shell program and the remote user is not the super-user; in that case
 the default is rsyncd.conf in the current directory (typically $HOME).
 
 dit(bf(--no-detach)) When running as a daemon, this option instructs
@@ -1502,6 +1565,9 @@ dit(bf(--port=PORT)) This specifies an alternate TCP port number for the
 daemon to listen on rather than the default of 873.  See also the "port"
 global option in the rsyncd.conf manpage.
 
+dit(bf(--sockopts)) This overrides the bf(socket options) setting in the
+rsyncd.conf file and has the same syntax.
+
 dit(bf(-v, --verbose)) This option increases the amount of information the
 daemon logs during its startup phase.  After the client connects, the
 daemon's verbosity level will be controlled by the options that the client