| 1 | <html><head> |
| 2 | <title>rsyncd.conf(5) manpage</title> |
| 3 | <meta charset="UTF-8"/> |
| 4 | <link href="https://fonts.googleapis.com/css2?family=Roboto&family=Roboto+Mono&display=swap" rel="stylesheet"> |
| 5 | <style> |
| 6 | body { |
| 7 | max-width: 50em; |
| 8 | margin: auto; |
| 9 | } |
| 10 | body, b, strong, u { |
| 11 | font-family: 'Roboto', sans-serif; |
| 12 | } |
| 13 | a.tgt { font-face: symbol; font-weight: 400; font-size: 70%; visibility: hidden; text-decoration: none; color: #ddd; padding: 0 4px; border: 0; } |
| 14 | a.tgt:after { content: '🔗'; } |
| 15 | a.tgt:hover { color: #444; background-color: #eaeaea; } |
| 16 | h1:hover > a.tgt, h2:hover > a.tgt, h3:hover > a.tgt, dt:hover > a.tgt { visibility: visible; } |
| 17 | code { |
| 18 | font-family: 'Roboto Mono', monospace; |
| 19 | font-weight: bold; |
| 20 | white-space: pre; |
| 21 | } |
| 22 | pre code { |
| 23 | display: block; |
| 24 | font-weight: normal; |
| 25 | } |
| 26 | blockquote pre code { |
| 27 | background: #f1f1f1; |
| 28 | } |
| 29 | dd p:first-of-type { |
| 30 | margin-block-start: 0em; |
| 31 | } |
| 32 | </style> |
| 33 | </head><body> |
| 34 | <h2 id="NAME">NAME<a href="#NAME" class="tgt"></a></h2> |
| 35 | <p>rsyncd.conf -⁠ configuration file for rsync in daemon mode</p> |
| 36 | <h2 id="SYNOPSIS">SYNOPSIS<a href="#SYNOPSIS" class="tgt"></a></h2> |
| 37 | <p>rsyncd.conf</p> |
| 38 | <p>The online version of this manpage (that includes cross-linking of topics) |
| 39 | is available at <a href="https://download.samba.org/pub/rsync/rsyncd.conf.5">https://download.samba.org/pub/rsync/rsyncd.conf.5</a>.</p> |
| 40 | <h2 id="DESCRIPTION">DESCRIPTION<a href="#DESCRIPTION" class="tgt"></a></h2> |
| 41 | <p>The rsyncd.conf file is the runtime configuration file for rsync when run as an |
| 42 | rsync daemon.</p> |
| 43 | <p>The rsyncd.conf file controls authentication, access, logging and available |
| 44 | modules.</p> |
| 45 | <h2 id="FILE_FORMAT">FILE FORMAT<a href="#FILE_FORMAT" class="tgt"></a></h2> |
| 46 | <p>The file consists of modules and parameters. A module begins with the name of |
| 47 | the module in square brackets and continues until the next module begins. |
| 48 | Modules contain parameters of the form <code>name = value</code>.</p> |
| 49 | <p>The file is line-based -⁠-⁠ that is, each newline-terminated line represents |
| 50 | either a comment, a module name or a parameter.</p> |
| 51 | <p>Only the first equals sign in a parameter is significant. Whitespace before or |
| 52 | after the first equals sign is discarded. Leading, trailing and internal |
| 53 | whitespace in module and parameter names is irrelevant. Leading and trailing |
| 54 | whitespace in a parameter value is discarded. Internal whitespace within a |
| 55 | parameter value is retained verbatim.</p> |
| 56 | <p>Any line <strong>beginning</strong> with a hash (<code>#</code>) is ignored, as are lines containing |
| 57 | only whitespace. (If a hash occurs after anything other than leading |
| 58 | whitespace, it is considered a part of the line's content.)</p> |
| 59 | <p>Any line ending in a <code>\</code> is "continued" on the next line in the customary UNIX |
| 60 | fashion.</p> |
| 61 | <p>The values following the equals sign in parameters are all either a string (no |
| 62 | quotes needed) or a boolean, which may be given as yes/no, 0/1 or true/false. |
| 63 | Case is not significant in boolean values, but is preserved in string values.</p> |
| 64 | <h2 id="LAUNCHING_THE_RSYNC_DAEMON">LAUNCHING THE RSYNC DAEMON<a href="#LAUNCHING_THE_RSYNC_DAEMON" class="tgt"></a></h2> |
| 65 | <p>The rsync daemon is launched by specifying the <code>--daemon</code> option to rsync.</p> |
| 66 | <p>The daemon must run with root privileges if you wish to use chroot, to bind to |
| 67 | a port numbered under 1024 (as is the default 873), or to set file ownership. |
| 68 | Otherwise, it must just have permission to read and write the appropriate data, |
| 69 | log, and lock files.</p> |
| 70 | <p>You can launch it either via inetd, as a stand-alone daemon, or from an rsync |
| 71 | client via a remote shell. If run as a stand-alone daemon then just run the |
| 72 | command "<code>rsync --daemon</code>" from a suitable startup script.</p> |
| 73 | <p>Systems using systemd can use the example unit files in the source tree's |
| 74 | <code>packaging/systemd</code> directory. The <code>rsync.service</code> file runs a stand-alone |
| 75 | daemon using <code>rsync --daemon --no-detach</code>, while <code>rsync.socket</code> and |
| 76 | <code>[email protected]</code> show a socket-activated setup for incoming connections. These |
| 77 | files may need local adjustment to match your installed rsync path, packaging |
| 78 | layout, and module policy.</p> |
| 79 | <p>When run via inetd you should add a line like this to /etc/services:</p> |
| 80 | <blockquote> |
| 81 | <pre><code>rsync 873/tcp |
| 82 | </code></pre> |
| 83 | </blockquote> |
| 84 | <p>and a single line something like this to /etc/inetd.conf:</p> |
| 85 | <blockquote> |
| 86 | <pre><code>rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon |
| 87 | </code></pre> |
| 88 | </blockquote> |
| 89 | <p>Replace "/usr/bin/rsync" with the path to where you have rsync installed on |
| 90 | your system. You will then need to send inetd a HUP signal to tell it to |
| 91 | reread its config file.</p> |
| 92 | <p>Note that you should <strong>not</strong> send the rsync daemon a HUP signal to force it to |
| 93 | reread the <code>rsyncd.conf</code> file. The file is re-read on each client connection.</p> |
| 94 | <h2 id="GLOBAL_PARAMETERS">GLOBAL PARAMETERS<a href="#GLOBAL_PARAMETERS" class="tgt"></a></h2> |
| 95 | <p>The first parameters in the file (before a [module] header) are the global |
| 96 | parameters:</p> |
| 97 | <dl> |
| 98 | |
| 99 | <dt id="motd_file"><code>motd file</code><a href="#motd_file" class="tgt"></a></dt><dd> |
| 100 | <p>This parameter allows you to specify a "message of the day" (MOTD) to display |
| 101 | to clients on each connect. This usually contains site information and any |
| 102 | legal notices. The default is no MOTD file. This can be overridden by the |
| 103 | <code>--dparam=motdfile=FILE</code> command-line option when starting the daemon.</p> |
| 104 | </dd> |
| 105 | |
| 106 | <dt id="pid_file"><code>pid file</code><a href="#pid_file" class="tgt"></a></dt><dd> |
| 107 | <p>This parameter tells the rsync daemon to write its process ID to that file. |
| 108 | The rsync keeps the file locked so that it can know when it is safe to |
| 109 | overwrite an existing file.</p> |
| 110 | <p>The filename can be overridden by the <code>--dparam=pidfile=FILE</code> command-line |
| 111 | option when starting the daemon.</p> |
| 112 | </dd> |
| 113 | |
| 114 | <dt id="port"><code>port</code><a href="#port" class="tgt"></a></dt><dd> |
| 115 | <p>You can override the default port the daemon will listen on by specifying |
| 116 | this value (defaults to 873). This is ignored if the daemon is being run |
| 117 | by inetd, and is superseded by the <code>--port</code> command-line option.</p> |
| 118 | </dd> |
| 119 | |
| 120 | <dt id="address"><code>address</code><a href="#address" class="tgt"></a></dt><dd> |
| 121 | <p>You can override the default IP address the daemon will listen on by |
| 122 | specifying this value. This is ignored if the daemon is being run by |
| 123 | inetd, and is superseded by the <code>--address</code> command-line option.</p> |
| 124 | </dd> |
| 125 | |
| 126 | <dt id="socket_options"><code>socket options</code><a href="#socket_options" class="tgt"></a></dt><dd> |
| 127 | <p>This parameter can provide endless fun for people who like to tune their |
| 128 | systems to the utmost degree. You can set all sorts of socket options which |
| 129 | may make transfers faster (or slower!). Read the manpage for the |
| 130 | <strong>setsockopt()</strong> system call for details on some of the options you may be |
| 131 | able to set. By default no special socket options are set. These settings |
| 132 | can also be specified via the <code>--sockopts</code> command-line option.</p> |
| 133 | </dd> |
| 134 | |
| 135 | <dt id="listen_backlog"><code>listen backlog</code><a href="#listen_backlog" class="tgt"></a></dt><dd> |
| 136 | <p>You can override the default backlog value when the daemon listens for |
| 137 | connections. It defaults to 5.</p> |
| 138 | </dd> |
| 139 | </dl> |
| 140 | <p>You may also include any <a href="#MODULE_PARAMETERS">MODULE PARAMETERS</a> in the global part of the |
| 141 | config file, in which case the supplied value will override the default for |
| 142 | that parameter.</p> |
| 143 | <p>You may use references to environment variables in the values of parameters. |
| 144 | String parameters will have %VAR% references expanded as late as possible (when |
| 145 | the string is first used in the program), allowing for the use of variables |
| 146 | that rsync sets at connection time, such as RSYNC_USER_NAME. Non-string |
| 147 | parameters (such as true/false settings) are expanded when read from the config |
| 148 | file. If a variable does not exist in the environment, or if a sequence of |
| 149 | characters is not a valid reference (such as an un-paired percent sign), the |
| 150 | raw characters are passed through unchanged. This helps with backward |
| 151 | compatibility and safety (e.g. expanding a non-existent %VAR% to an empty |
| 152 | string in a path could result in a very unsafe path). The safest way to insert |
| 153 | a literal % into a value is to use %%.</p> |
| 154 | <h2 id="MODULE_PARAMETERS">MODULE PARAMETERS<a href="#MODULE_PARAMETERS" class="tgt"></a></h2> |
| 155 | <p>After the global parameters you should define a number of modules, each module |
| 156 | exports a directory tree as a symbolic name. Modules are exported by specifying |
| 157 | a module name in square brackets [module] followed by the parameters for that |
| 158 | module. The module name cannot contain a slash or a closing square bracket. |
| 159 | If the name contains whitespace, each internal sequence of whitespace will be |
| 160 | changed into a single space, while leading or trailing whitespace will be |
| 161 | discarded.</p> |
| 162 | <p>There is also a special module name of "[global]" that does not define a module |
| 163 | but instead switches back to the global settings context where default |
| 164 | parameters can be specified. Because each defined module gets its full set of |
| 165 | parameters as a combination of the default values that are set at that position |
| 166 | in the config file plus its own parameter list, the use of a "[global]" section |
| 167 | can help to maintain shared config values for multiple modules.</p> |
| 168 | <p>As with <a href="#GLOBAL_PARAMETERS">GLOBAL PARAMETERS</a>, you may use references to environment variables |
| 169 | in the values of parameters. See that section for details.</p> |
| 170 | <dl> |
| 171 | |
| 172 | <dt id="comment"><code>comment</code><a href="#comment" class="tgt"></a></dt><dd> |
| 173 | <p>This parameter specifies a description string that is displayed next to the |
| 174 | module name when clients obtain a list of available modules. The default is |
| 175 | no comment.</p> |
| 176 | </dd> |
| 177 | |
| 178 | <dt id="path"><code>path</code><a href="#path" class="tgt"></a></dt><dd> |
| 179 | <p>This parameter specifies the directory in the daemon's filesystem to make |
| 180 | available in this module. You must specify this parameter for each module |
| 181 | in <code>rsyncd.conf</code>.</p> |
| 182 | <p>If the value contains a "/./" element then the path will be divided at that |
| 183 | point into a chroot dir and an inner-chroot subdir. If <a href="#use_chroot"><code>use chroot</code></a> |
| 184 | is set to false, though, the extraneous dot dir is just cleaned out of the |
| 185 | path. An example of this idiom is:</p> |
| 186 | <blockquote> |
| 187 | <pre><code>path = /var/rsync/./module1 |
| 188 | </code></pre> |
| 189 | </blockquote> |
| 190 | <p>This will (when chrooting) chroot to "/var/rsync" and set the inside-chroot |
| 191 | path to "/module1".</p> |
| 192 | <p>You may base the path's value off of an environment variable by surrounding |
| 193 | the variable name with percent signs. You can even reference a variable |
| 194 | that is set by rsync when the user connects. For example, this would use |
| 195 | the authorizing user's name in the path:</p> |
| 196 | <blockquote> |
| 197 | <pre><code>path = /home/%RSYNC_USER_NAME% |
| 198 | </code></pre> |
| 199 | </blockquote> |
| 200 | <p>It is fine if the path includes internal spaces -⁠-⁠ they will be retained |
| 201 | verbatim (which means that you shouldn't try to escape them). If your |
| 202 | final directory has a trailing space (and this is somehow not something you |
| 203 | wish to fix), append a trailing slash to the path to avoid losing the |
| 204 | trailing whitespace.</p> |
| 205 | </dd> |
| 206 | |
| 207 | <dt id="use_chroot"><code>use chroot</code><a href="#use_chroot" class="tgt"></a></dt><dd> |
| 208 | <p>If "use chroot" is true, the rsync daemon will chroot to the "<a href="#path">path</a>" before |
| 209 | starting the file transfer with the client. This has the advantage of |
| 210 | extra protection against possible implementation security holes, but it has |
| 211 | the disadvantages of requiring super-user privileges, of not being able to |
| 212 | follow symbolic links that are either absolute or outside of the new root |
| 213 | path, and of complicating the preservation of users and groups by name (see |
| 214 | below).</p> |
| 215 | <p>If <code>use chroot</code> is not set, it defaults to trying to enable a chroot but |
| 216 | allows the daemon to continue (after logging a warning) if it fails. The |
| 217 | one exception to this is when a module's <a href="#path"><code>path</code></a> has a "/./" chroot |
| 218 | divider in it -⁠-⁠ this causes an unset value to be treated as true for that |
| 219 | module.</p> |
| 220 | <p>Prior to rsync 3.2.7, the default value was "true". The new "unset" |
| 221 | default makes it easier to setup an rsync daemon as a non-root user or to |
| 222 | run a daemon on a system where chroot fails. Explicitly setting the value |
| 223 | to "true" in rsyncd.conf will always require the chroot to succeed.</p> |
| 224 | <p>It is also possible to specify a dot-dir in the module's "<a href="#path">path</a>" to |
| 225 | indicate that you want to chdir to the earlier part of the path and then |
| 226 | serve files from inside the latter part of the path (with sanitizing and |
| 227 | default symlink munging). This can be useful if you need some library dirs |
| 228 | inside the chroot (typically for uid & gid lookups) but don't want to put |
| 229 | the lib dir into the top of the served path (even though they can be hidden |
| 230 | with an <a href="#exclude"><code>exclude</code></a> directive). However, a better choice for a modern |
| 231 | rsync setup is to use a <a href="#name_converter"><code>name converter</code></a>" and try to avoid inner lib |
| 232 | dirs altogether. See also the <a href="#daemon_chroot"><code>daemon chroot</code></a> parameter, which causes |
| 233 | rsync to chroot into its own chroot area before doing any path-related |
| 234 | chrooting.</p> |
| 235 | <p>If the daemon is serving the "/" dir (either directly or due to being |
| 236 | chrooted to the module's path), rsync does not do any path sanitizing or |
| 237 | (default) munging.</p> |
| 238 | <p>When it has to limit access to a particular subdir (either due to chroot |
| 239 | being disabled or having an inside-chroot path set), rsync will munge |
| 240 | symlinks (by default) and sanitize paths. Those that dislike munged |
| 241 | symlinks can disable the symlink munging via the "<a href="#munge_symlinks">munge symlinks</a>" |
| 242 | parameter; incoming symlink values are then sanitized instead (see that |
| 243 | parameter).</p> |
| 244 | <p>When rsync is sanitizing paths, it resolves away the ".." path elements that |
| 245 | would take an arg above the module hierarchy. For an operator-supplied |
| 246 | option path such as <code>--backup-dir</code> & <code>--compare-dest</code>, a leading slash is |
| 247 | also substituted with the module's path (so an absolute path is interpreted |
| 248 | as rooted in the module's "<a href="#path">path</a>" dir); for the transfer's own source |
| 249 | args a leading slash is simply dropped.</p> |
| 250 | <p>When a chroot is in effect <u>and</u> the "<a href="#name_converter">name converter</a>" parameter is |
| 251 | <u>not</u> set, the "<a href="#numeric_ids">numeric ids</a>" parameter will default to being enabled |
| 252 | (disabling name lookups). This means that if you manually setup |
| 253 | name-lookup libraries in your chroot (instead of using a name converter) |
| 254 | that you need to explicitly set <code>numeric ids = false</code> for rsync to do name |
| 255 | lookups.</p> |
| 256 | <p>If you copy library resources into the module's chroot area, you should |
| 257 | protect them through your OS's normal user/group or ACL settings (to |
| 258 | prevent the rsync module's user from being able to change them), and then |
| 259 | hide them from the user's view via "<a href="#exclude">exclude</a>" (see how in the discussion of |
| 260 | that parameter). However, it's easier and safer to setup a name converter.</p> |
| 261 | </dd> |
| 262 | |
| 263 | <dt id="daemon_chroot"><code>daemon chroot</code><a href="#daemon_chroot" class="tgt"></a></dt><dd> |
| 264 | <p>This parameter specifies a path to which the daemon will chroot before |
| 265 | beginning communication with clients. Module paths (and any "<a href="#use_chroot">use chroot</a>" |
| 266 | settings) will then be related to this one. This lets you choose if you |
| 267 | want the whole daemon to be chrooted (with this setting), just the |
| 268 | transfers to be chrooted (with "<a href="#use_chroot">use chroot</a>"), or both. Keep in mind that |
| 269 | the "daemon chroot" area may need various OS/lib/etc files installed to |
| 270 | allow the daemon to function. By default the daemon runs without any |
| 271 | chrooting.</p> |
| 272 | </dd> |
| 273 | |
| 274 | <dt id="proxy_protocol"><code>proxy protocol</code><a href="#proxy_protocol" class="tgt"></a></dt><dd> |
| 275 | <p>When this parameter is enabled, all incoming connections must start with a |
| 276 | V1 or V2 proxy protocol header. If the header is not found, the connection |
| 277 | is closed.</p> |
| 278 | <p>Setting this to <code>true</code> requires a proxy server to forward source IP |
| 279 | information to rsync, allowing you to log proper IP/host info and make use |
| 280 | of client-oriented IP restrictions. The default of <code>false</code> means that the |
| 281 | IP information comes directly from the socket's metadata. If rsync is not |
| 282 | behind a proxy, this should be disabled.</p> |
| 283 | <p><u>CAUTION</u>: using this option can be dangerous if you do not ensure that |
| 284 | only the proxy is allowed to connect to the rsync port. If any non-proxied |
| 285 | connections are allowed through, the client will be able to use a modified |
| 286 | rsync to spoof any remote IP address that they desire. You can lock this |
| 287 | down using something like iptables <code>-uid-owner root</code> rules (for strict |
| 288 | localhost access), various firewall rules, or you can require password |
| 289 | authorization so that any spoofing by users will not grant extra access.</p> |
| 290 | <p>This setting is global. If you need some modules to require this and not |
| 291 | others, then you will need to setup multiple rsync daemon processes on |
| 292 | different ports.</p> |
| 293 | </dd> |
| 294 | |
| 295 | <dt id="proxy_protocol_hosts"><code>proxy protocol hosts</code><a href="#proxy_protocol_hosts" class="tgt"></a></dt><dd> |
| 296 | <p>This global parameter lists the socket peer IP addresses that are allowed |
| 297 | to supply a <code>proxy protocol</code> header. The syntax is the same token format |
| 298 | used by <code>hosts allow</code>. When <code>proxy protocol = true</code>, this list must match |
| 299 | the direct peer before rsync trusts the forwarded client address.</p> |
| 300 | </dd> |
| 301 | |
| 302 | <dt id="name_converter"><code>name converter</code><a href="#name_converter" class="tgt"></a></dt><dd> |
| 303 | <p>This parameter lets you specify a program that will be run by the rsync |
| 304 | daemon to do user & group conversions between names & ids. This script |
| 305 | is started prior to any chroot being setup, and runs as the daemon user |
| 306 | (not the transfer user). You can specify a fully qualified pathname or |
| 307 | a program name that is on the $PATH.</p> |
| 308 | <p>The program can be used to do normal user & group lookups without having to |
| 309 | put any extra files into the chroot area of the module <u>or</u> you can do |
| 310 | customized conversions.</p> |
| 311 | <p>The nameconvert program has access to all of the environment variables that |
| 312 | are described in the section on <code>pre-xfer exec</code>. This is useful if you |
| 313 | want to customize the conversion using information about the module and/or |
| 314 | the copy request.</p> |
| 315 | <p>There is a sample python script in the support dir named "nameconvert" that |
| 316 | implements the normal user & group lookups. Feel free to customize it or |
| 317 | just use it as documentation to implement your own.</p> |
| 318 | </dd> |
| 319 | |
| 320 | <dt id="numeric_ids"><code>numeric ids</code><a href="#numeric_ids" class="tgt"></a></dt><dd> |
| 321 | <p>Enabling this parameter disables the mapping of users and groups by name |
| 322 | for the current daemon module. This prevents the daemon from trying to |
| 323 | load any user/group-related files or libraries. This enabling makes the |
| 324 | transfer behave as if the client had passed the <code>--numeric-ids</code> |
| 325 | command-line option. By default, this parameter is enabled for chroot |
| 326 | modules and disabled for non-chroot modules. Also keep in mind that |
| 327 | uid/gid preservation requires the module to be running as root (see "<a href="#uid">uid</a>") |
| 328 | or for "<a href="#fake_super">fake super</a>" to be configured.</p> |
| 329 | <p>A chroot-enabled module should not have this parameter set to false unless |
| 330 | you're using a "<a href="#name_converter">name converter</a>" program <u>or</u> you've taken steps to ensure |
| 331 | that the module has the necessary resources it needs to translate names and |
| 332 | that it is not possible for a user to change those resources.</p> |
| 333 | </dd> |
| 334 | |
| 335 | <dt id="munge_symlinks"><code>munge symlinks</code><a href="#munge_symlinks" class="tgt"></a></dt><dd> |
| 336 | <p>This parameter tells rsync to modify all incoming symlinks the same way as |
| 337 | the (non-daemon-affecting) <code>--munge-links</code> command-line option: it prefixes |
| 338 | each stored symlink's value with the string "/rsyncd-munged/". Because that |
| 339 | directory does not normally exist, a munged symlink cannot be followed, so |
| 340 | an uploaded symlink cannot be used to read or write a file through it. On |
| 341 | the way back out the prefix is stripped, so clients see the original symlink |
| 342 | values. When this parameter is enabled, rsync refuses to run a module if |
| 343 | "/rsyncd-munged/" already exists in it as a directory or a symlink to a |
| 344 | directory. The default depends on chroot. For a plain chrooted module -⁠-⁠ |
| 345 | "<a href="#use_chroot">use chroot</a>" on and "<a href="#path">path</a>" with no "/./" split, so the daemon |
| 346 | chroots straight into the module and serves it as the chroot root -⁠-⁠ munging |
| 347 | is disabled by default, since the chroot itself already stops a symlink from |
| 348 | escaping. In every other case it is enabled: any non-chroot module, or a |
| 349 | chroot module whose "<a href="#path">path</a>" uses a "/./" split to serve an inner subdir |
| 350 | below the chroot root.</p> |
| 351 | <p>When this parameter is disabled on a writable module whose access is limited |
| 352 | to a subdir (i.e. "<a href="#use_chroot">use chroot</a>" is off, or the inside-chroot path is not |
| 353 | "/"), an incoming symlink is not prefixed but is still sanitized as it is |
| 354 | stored: a leading slash is dropped and any leading ".." components that would |
| 355 | take the value above the module are removed, so a stored symlink's value |
| 356 | cannot name a path outside the module (it can still point to another name |
| 357 | inside the module).</p> |
| 358 | <p>Munging changes only the symlink VALUES that are stored. Whether the daemon |
| 359 | follows a <u>pre-existing</u> in-module symlink when it resolves a transfer path |
| 360 | is a separate matter, governed by the secure path resolver that is on by |
| 361 | default; see the "<a href="#insecure_links">insecure links</a>" parameter for the exact rule and how |
| 362 | to opt out of it.</p> |
| 363 | <p>When using the "munge symlinks" parameter in a chroot area that has an |
| 364 | inside-chroot path of "/", you should add "/rsyncd-munged/" to the exclude |
| 365 | setting for the module so that a user can't try to create it.</p> |
| 366 | <p>To add or remove the "/rsyncd-munged/" prefix on symlinks yourself (for |
| 367 | instance on links you create locally inside a module), there is a python |
| 368 | script in the support directory of the source code named "munge-symlinks".</p> |
| 369 | </dd> |
| 370 | |
| 371 | <dt id="insecure_links"><code>insecure links</code><a href="#insecure_links" class="tgt"></a></dt><dd> |
| 372 | <p>This parameter (defaulting to "false") controls whether the daemon resolves |
| 373 | its symlink-bearing paths with the normal symlink-race defences or with the |
| 374 | legacy follow-any-symlink behaviour.</p> |
| 375 | <p>When false (the default), the daemon refuses to follow a symlink it did not |
| 376 | create -⁠-⁠ the directory enumeration and file-content opens of the served |
| 377 | module, and the operator-supplied paths (<code>--backup-dir</code>, <code>--temp-dir</code>, |
| 378 | <code>--partial-dir</code>, the alt-dest basis dirs, and so on) are all resolved with a |
| 379 | walk that follows a symlink component only when it is owned by uid 0 or |
| 380 | by the uid the module runs as, refusing one planted by any other user. A |
| 381 | client can never relax this: a client that sends <code>--insecure-links</code> to the |
| 382 | daemon has its request refused.</p> |
| 383 | <p>Setting this parameter to "true" restores the pre-hardening behaviour for |
| 384 | <strong>this module only</strong>: the daemon follows <strong>any</strong> symlink in those paths.</p> |
| 385 | <blockquote> |
| 386 | <p><strong>WARNING:</strong> enabling "insecure links" re-opens the symlink-escape / |
| 387 | TOCTOU vulnerabilities that the default closes (including CVE-2026-53797 |
| 388 | and CVE-2026-53801): an attacker who can create a symlink inside the module -⁠-⁠ or who shares the host with the served tree -⁠-⁠ can redirect the daemon's |
| 389 | reads and writes to files <strong>outside</strong> the module. Enable it <strong>only</strong> on a |
| 390 | single-tenant, fully-isolated, or otherwise trusted host where no untrusted |
| 391 | local user can plant a symlink in the served tree. It is the daemon |
| 392 | analogue of the client's <code>--insecure-links</code> and exists for the same narrow |
| 393 | "I accept the risk in my isolated environment" case.</p> |
| 394 | </blockquote> |
| 395 | </dd> |
| 396 | |
| 397 | <dt id="charset"><code>charset</code><a href="#charset" class="tgt"></a></dt><dd> |
| 398 | <p>This specifies the name of the character set in which the module's |
| 399 | filenames are stored. If the client uses an <code>--iconv</code> option, the daemon |
| 400 | will use the value of the "charset" parameter regardless of the character |
| 401 | set the client actually passed. This allows the daemon to support charset |
| 402 | conversion in a chroot module without extra files in the chroot area, and |
| 403 | also ensures that name-translation is done in a consistent manner. If the |
| 404 | "charset" parameter is not set, the <code>--iconv</code> option is refused, just as if |
| 405 | "iconv" had been specified via "<a href="#refuse_options">refuse options</a>".</p> |
| 406 | <p>If you wish to force users to always use <code>--iconv</code> for a particular module, |
| 407 | add "no-iconv" to the "<a href="#refuse_options">refuse options</a>" parameter. Keep in mind that this |
| 408 | will restrict access to your module to very new rsync clients.</p> |
| 409 | </dd> |
| 410 | |
| 411 | <dt id="max_connections"><code>max connections</code><a href="#max_connections" class="tgt"></a></dt><dd> |
| 412 | <p>This parameter allows you to specify the maximum number of simultaneous |
| 413 | connections you will allow. Any clients connecting when the maximum has |
| 414 | been reached will receive a message telling them to try later. The default |
| 415 | is 0, which means no limit. A negative value disables the module. See |
| 416 | also the "<a href="#lock_file">lock file</a>" parameter.</p> |
| 417 | </dd> |
| 418 | |
| 419 | <dt id="log_file"><code>log file</code><a href="#log_file" class="tgt"></a></dt><dd> |
| 420 | <p>When the "log file" parameter is set to a non-empty string, the rsync |
| 421 | daemon will log messages to the indicated file rather than using syslog. |
| 422 | This is particularly useful on systems (such as AIX) where <strong>syslog()</strong> |
| 423 | doesn't work for chrooted programs. The file is opened before <strong>chroot()</strong> |
| 424 | is called, allowing it to be placed outside the transfer. If this value is |
| 425 | set on a per-module basis instead of globally, the global log will still |
| 426 | contain any authorization failures or config-file error messages.</p> |
| 427 | <p>If the daemon fails to open the specified file, it will fall back to using |
| 428 | syslog and output an error about the failure. (Note that the failure to |
| 429 | open the specified log file used to be a fatal error.)</p> |
| 430 | <p>This setting can be overridden by using the <code>--log-file=FILE</code> or |
| 431 | <code>--dparam=logfile=FILE</code> command-line options. The former overrides all the |
| 432 | log-file parameters of the daemon and all module settings. The latter sets |
| 433 | the daemon's log file and the default for all the modules, which still |
| 434 | allows modules to override the default setting.</p> |
| 435 | </dd> |
| 436 | |
| 437 | <dt id="syslog_facility"><code>syslog facility</code><a href="#syslog_facility" class="tgt"></a></dt><dd> |
| 438 | <p>This parameter allows you to specify the syslog facility name to use when |
| 439 | logging messages from the rsync daemon. You may use any standard syslog |
| 440 | facility name which is defined on your system. Common names are auth, |
| 441 | authpriv, cron, daemon, ftp, kern, lpr, mail, news, security, syslog, user, |
| 442 | uucp, local0, local1, local2, local3, local4, local5, local6 and local7. |
| 443 | The default is daemon. This setting has no effect if the "<a href="#log_file">log file</a>" |
| 444 | setting is a non-empty string (either set in the per-modules settings, or |
| 445 | inherited from the global settings).</p> |
| 446 | </dd> |
| 447 | |
| 448 | <dt id="syslog_tag"><code>syslog tag</code><a href="#syslog_tag" class="tgt"></a></dt><dd> |
| 449 | <p>This parameter allows you to specify the syslog tag to use when logging |
| 450 | messages from the rsync daemon. The default is "rsyncd". This setting has |
| 451 | no effect if the "<a href="#log_file">log file</a>" setting is a non-empty string (either set in |
| 452 | the per-modules settings, or inherited from the global settings).</p> |
| 453 | <p>For example, if you wanted each authenticated user's name to be included in |
| 454 | the syslog tag, you could do something like this:</p> |
| 455 | <blockquote> |
| 456 | <pre><code>syslog tag = rsyncd.%RSYNC_USER_NAME% |
| 457 | </code></pre> |
| 458 | </blockquote> |
| 459 | </dd> |
| 460 | |
| 461 | <dt id="max_verbosity"><code>max verbosity</code><a href="#max_verbosity" class="tgt"></a></dt><dd> |
| 462 | <p>This parameter allows you to control the maximum amount of verbose |
| 463 | information that you'll allow the daemon to generate (since the information |
| 464 | goes into the log file). The default is 1, which allows the client to |
| 465 | request one level of verbosity.</p> |
| 466 | <p>This also affects the user's ability to request higher levels of <code>--info</code> |
| 467 | and <code>--debug</code> logging. If the max value is 2, then no info and/or debug |
| 468 | value that is higher than what would be set by <code>-vv</code> will be honored by the |
| 469 | daemon in its logging. To see how high of a verbosity level you need to |
| 470 | accept for a particular info/debug level, refer to <code>rsync --info=help</code> and |
| 471 | <code>rsync --debug=help</code>. For instance, it takes max-verbosity 4 to be able to |
| 472 | output debug TIME2 and FLIST3.</p> |
| 473 | </dd> |
| 474 | |
| 475 | <dt id="lock_file"><code>lock file</code><a href="#lock_file" class="tgt"></a></dt><dd> |
| 476 | <p>This parameter specifies the file to use to support the "<a href="#max_connections">max connections</a>" |
| 477 | parameter. The rsync daemon uses record locking on this file to ensure that |
| 478 | the max connections limit is not exceeded for the modules sharing the lock |
| 479 | file. The default is <code>/var/run/rsyncd.lock</code>.</p> |
| 480 | </dd> |
| 481 | |
| 482 | <dt id="read_only"><code>read only</code><a href="#read_only" class="tgt"></a></dt><dd> |
| 483 | <p>This parameter determines whether clients will be able to upload files or |
| 484 | not. If "read only" is true then any attempted uploads will fail. If |
| 485 | "read only" is false then uploads will be possible if file permissions on |
| 486 | the daemon side allow them. The default is for all modules to be read only.</p> |
| 487 | <p>Note that "<a href="#auth_users">auth users</a>" can override this setting on a per-user basis.</p> |
| 488 | </dd> |
| 489 | |
| 490 | <dt id="write_only"><code>write only</code><a href="#write_only" class="tgt"></a></dt><dd> |
| 491 | <p>This parameter determines whether clients will be able to download files or |
| 492 | not. If "write only" is true then any attempted downloads will fail. If |
| 493 | "write only" is false then downloads will be possible if file permissions |
| 494 | on the daemon side allow them. The default is for this parameter to be |
| 495 | disabled.</p> |
| 496 | <p>Helpful hint: you probably want to specify "refuse options = delete" for a |
| 497 | write-only module.</p> |
| 498 | </dd> |
| 499 | |
| 500 | <dt id="open_noatime"><code>open noatime</code><a href="#open_noatime" class="tgt"></a></dt><dd> |
| 501 | <p>When set to True, this parameter tells the rsync daemon to open files with |
| 502 | the O_NOATIME flag |
| 503 | (on systems that support it) to avoid changing the access time of the files |
| 504 | that are being transferred. If your OS does not support the O_NOATIME flag |
| 505 | then rsync will silently ignore this option. Note also that some |
| 506 | filesystems are mounted to avoid updating the atime on read access even |
| 507 | without the O_NOATIME flag being set.</p> |
| 508 | <p>When set to False, this parameters ensures that files on the server are not |
| 509 | opened with O_NOATIME.</p> |
| 510 | <p>When set to Unset (the default) the user controls the setting via |
| 511 | <code>--open-noatime</code>.</p> |
| 512 | </dd> |
| 513 | |
| 514 | <dt id="list"><code>list</code><a href="#list" class="tgt"></a></dt><dd> |
| 515 | <p>This parameter determines whether this module is listed when the client |
| 516 | asks for a listing of available modules. In addition, if this is false, |
| 517 | the daemon will pretend the module does not exist when a client denied by |
| 518 | "<a href="#hosts_allow">hosts allow</a>" or "<a href="#hosts_deny">hosts deny</a>" attempts to access it. Realize that if |
| 519 | "<a href="#reverse_lookup">reverse lookup</a>" is disabled globally but enabled for the module, the |
| 520 | resulting reverse lookup to a potentially client-controlled DNS server may |
| 521 | still reveal to the client that it hit an existing module. The default is |
| 522 | for modules to be listable.</p> |
| 523 | </dd> |
| 524 | |
| 525 | <dt id="uid"><code>uid</code><a href="#uid" class="tgt"></a></dt><dd> |
| 526 | <p>This parameter specifies the user name or user ID that file transfers to |
| 527 | and from that module should take place as when the daemon was run as root. |
| 528 | In combination with the "<a href="#gid">gid</a>" parameter this determines what file |
| 529 | permissions are available. The default when run by a super-user is to |
| 530 | switch to the system's "nobody" user. The default for a non-super-user is |
| 531 | to not try to change the user. See also the "<a href="#gid">gid</a>" parameter.</p> |
| 532 | <p>The RSYNC_USER_NAME environment variable may be used to request that rsync |
| 533 | run as the authorizing user. For example, if you want a rsync to run as |
| 534 | the same user that was received for the rsync authentication, this setup is |
| 535 | useful:</p> |
| 536 | <blockquote> |
| 537 | <pre><code>uid = %RSYNC_USER_NAME% |
| 538 | gid = * |
| 539 | </code></pre> |
| 540 | </blockquote> |
| 541 | </dd> |
| 542 | |
| 543 | <dt id="gid"><code>gid</code><a href="#gid" class="tgt"></a></dt><dd> |
| 544 | <p>This parameter specifies one or more group names/IDs that will be used when |
| 545 | accessing the module. The first one will be the default group, and any |
| 546 | extra ones be set as supplemental groups. You may also specify a "<code>*</code>" as |
| 547 | the first gid in the list, which will be replaced by all the normal groups |
| 548 | for the transfer's user (see "<a href="#uid">uid</a>"). The default when run by a super-user |
| 549 | is to switch to your OS's "nobody" (or perhaps "nogroup") group with no |
| 550 | other supplementary groups. The default for a non-super-user is to not |
| 551 | change any group attributes (and indeed, your OS may not allow a |
| 552 | non-super-user to try to change their group settings).</p> |
| 553 | <p>The specified list is normally split into tokens based on spaces and |
| 554 | commas. However, if the list starts with a comma, then the list is only |
| 555 | split on commas, which allows a group name to contain a space. In either |
| 556 | case any leading and/or trailing whitespace is removed from the tokens and |
| 557 | empty tokens are ignored.</p> |
| 558 | </dd> |
| 559 | |
| 560 | <dt id="daemon_uid"><code>daemon uid</code><a href="#daemon_uid" class="tgt"></a></dt><dd> |
| 561 | <p>This parameter specifies a uid under which the daemon will run. The daemon |
| 562 | usually runs as user root, and when this is left unset the user is left |
| 563 | unchanged. See also the "<a href="#uid">uid</a>" parameter.</p> |
| 564 | </dd> |
| 565 | |
| 566 | <dt id="daemon_gid"><code>daemon gid</code><a href="#daemon_gid" class="tgt"></a></dt><dd> |
| 567 | <p>This parameter specifies a gid under which the daemon will run. The daemon |
| 568 | usually runs as group root, and when this is left unset, the group is left |
| 569 | unchanged. See also the "<a href="#gid">gid</a>" parameter.</p> |
| 570 | </dd> |
| 571 | |
| 572 | <dt id="fake_super"><code>fake super</code><a href="#fake_super" class="tgt"></a></dt><dd> |
| 573 | <p>Setting "fake super = yes" for a module causes the daemon side to behave as |
| 574 | if the <code>--fake-super</code> command-line option had been specified. This allows |
| 575 | the full attributes of a file to be stored without having to have the |
| 576 | daemon actually running as root.</p> |
| 577 | </dd> |
| 578 | |
| 579 | <dt id="filter"><code>filter</code><a href="#filter" class="tgt"></a></dt><dd> |
| 580 | <p>The daemon has its own filter chain that determines what files it will let |
| 581 | the client access. This chain is not sent to the client and is independent |
| 582 | of any filters the client may have specified. Files excluded by the daemon |
| 583 | filter chain (<code>daemon-excluded</code> files) are treated as non-existent if the |
| 584 | client tries to pull them, are skipped with an error message if the client |
| 585 | tries to push them (triggering exit code 23), and are never deleted from |
| 586 | the module. You can use daemon filters to prevent clients from downloading |
| 587 | or tampering with private administrative files, such as files you may add |
| 588 | to support uid/gid name translations.</p> |
| 589 | <p>The daemon filter chain is built from the "filter", "<a href="#include_from">include from</a>", |
| 590 | "<a href="#include">include</a>", "<a href="#exclude_from">exclude from</a>", and "<a href="#exclude">exclude</a>" parameters, in that order of |
| 591 | priority. Anchored patterns are anchored at the root of the module. To |
| 592 | prevent access to an entire subtree, for example, "<code>/secret</code>", you <strong>must</strong> |
| 593 | exclude everything in the subtree; the easiest way to do this is with a |
| 594 | triple-star pattern like "<code>/secret/***</code>".</p> |
| 595 | <p>The filter chain matches the <strong>logical name</strong> of each item relative to the |
| 596 | module root, not the physical file it resolves to. It is a visibility and |
| 597 | tamper filter, <strong>not</strong> a security boundary against symlinks: a symlink inside |
| 598 | the module whose own name is not excluded can still be followed to an excluded |
| 599 | target (the name the filter sees -⁠-⁠ e.g. "<code>link</code>" -⁠-⁠ is not the excluded name -⁠-⁠ e.g. "<code>secret</code>"). What protects a writable module from symlink trickery is |
| 600 | the "<a href="#munge_symlinks">munge symlinks</a>" parameter (enabled by default for a writable, |
| 601 | non-chrooted module), <strong>not</strong> this filter; do not rely on <code>exclude</code>/<code>filter</code> to |
| 602 | confine a peer who can introduce or traverse a symlink.</p> |
| 603 | <p>The "filter" parameter takes a space-separated list of daemon filter rules, |
| 604 | though it is smart enough to know not to split a token at an internal space |
| 605 | in a rule (e.g. "<code>- /foo - /bar</code>" is parsed as two rules). You may specify |
| 606 | one or more merge-file rules using the normal syntax. Only one "filter" |
| 607 | parameter can apply to a given module in the config file, so put all the |
| 608 | rules you want in a single parameter. Note that per-directory merge-file |
| 609 | rules do not provide as much protection as global rules, but they can be |
| 610 | used to make <code>--delete</code> work better during a client download operation if |
| 611 | the per-dir merge files are included in the transfer and the client |
| 612 | requests that they be used.</p> |
| 613 | </dd> |
| 614 | |
| 615 | <dt id="exclude"><code>exclude</code><a href="#exclude" class="tgt"></a></dt><dd> |
| 616 | <p>This parameter takes a space-separated list of daemon exclude patterns. As |
| 617 | with the client <code>--exclude</code> option, patterns can be qualified with "<code>- </code>" or |
| 618 | "<code>+ </code>" to explicitly indicate exclude/include. Only one "exclude" parameter |
| 619 | can apply to a given module. See the "filter" parameter for a description |
| 620 | of how excluded files affect the daemon.</p> |
| 621 | </dd> |
| 622 | |
| 623 | <dt id="include"><code>include</code><a href="#include" class="tgt"></a></dt><dd> |
| 624 | <p>Use an "include" to override the effects of the "<a href="#exclude">exclude</a>" parameter. Only |
| 625 | one "include" parameter can apply to a given module. See the "<a href="#filter">filter</a>" |
| 626 | parameter for a description of how excluded files affect the daemon.</p> |
| 627 | </dd> |
| 628 | |
| 629 | <dt id="exclude_from"><code>exclude from</code><a href="#exclude_from" class="tgt"></a></dt><dd> |
| 630 | <p>This parameter specifies the name of a file on the daemon that contains |
| 631 | daemon exclude patterns, one per line. Only one "exclude from" parameter |
| 632 | can apply to a given module; if you have multiple exclude-from files, you |
| 633 | can specify them as a merge file in the "<a href="#filter">filter</a>" parameter. See the |
| 634 | "<a href="#filter">filter</a>" parameter for a description of how excluded files affect the |
| 635 | daemon.</p> |
| 636 | </dd> |
| 637 | |
| 638 | <dt id="include_from"><code>include from</code><a href="#include_from" class="tgt"></a></dt><dd> |
| 639 | <p>Analogue of "<a href="#exclude_from">exclude from</a>" for a file of daemon include patterns. Only one |
| 640 | "include from" parameter can apply to a given module. See the "<a href="#filter">filter</a>" |
| 641 | parameter for a description of how excluded files affect the daemon.</p> |
| 642 | </dd> |
| 643 | |
| 644 | <dt id="incoming_chmod"><code>incoming chmod</code><a href="#incoming_chmod" class="tgt"></a></dt><dd> |
| 645 | <p>This parameter allows you to specify a set of comma-separated chmod strings |
| 646 | that will affect the permissions of all incoming files (files that are |
| 647 | being received by the daemon). These changes happen after all other |
| 648 | permission calculations, and this will even override destination-default |
| 649 | and/or existing permissions when the client does not specify <code>--perms</code>. |
| 650 | See the description of the <code>--chmod</code> rsync option and the <strong>chmod</strong>(1) |
| 651 | manpage for information on the format of this string.</p> |
| 652 | </dd> |
| 653 | |
| 654 | <dt id="outgoing_chmod"><code>outgoing chmod</code><a href="#outgoing_chmod" class="tgt"></a></dt><dd> |
| 655 | <p>This parameter allows you to specify a set of comma-separated chmod strings |
| 656 | that will affect the permissions of all outgoing files (files that are |
| 657 | being sent out from the daemon). These changes happen first, making the |
| 658 | sent permissions appear to be different than those stored in the filesystem |
| 659 | itself. For instance, you could disable group write permissions on the |
| 660 | server while having it appear to be on to the clients. See the description |
| 661 | of the <code>--chmod</code> rsync option and the <strong>chmod</strong>(1) manpage for information |
| 662 | on the format of this string.</p> |
| 663 | </dd> |
| 664 | |
| 665 | <dt id="auth_users"><code>auth users</code><a href="#auth_users" class="tgt"></a></dt><dd> |
| 666 | <p>This parameter specifies a comma and/or space-separated list of |
| 667 | authorization rules. In its simplest form, you list the usernames that |
| 668 | will be allowed to connect to this module. The usernames do not need to |
| 669 | exist on the local system. The rules may contain shell wildcard characters |
| 670 | that will be matched against the username provided by the client for |
| 671 | authentication. If "auth users" is set then the client will be challenged |
| 672 | to supply a username and password to connect to the module. A challenge |
| 673 | response authentication protocol is used for this exchange. The plain text |
| 674 | usernames and passwords are stored in the file specified by the |
| 675 | "<a href="#secrets_file">secrets file</a>" parameter. The default is for all users to be able to |
| 676 | connect without a password (this is called "anonymous rsync").</p> |
| 677 | <p>In addition to username matching, you can specify groupname matching via a |
| 678 | '@' prefix. When using groupname matching, the authenticating username |
| 679 | must be a real user on the system, or it will be assumed to be a member of |
| 680 | no groups. For example, specifying "@rsync" will match the authenticating |
| 681 | user if the named user is a member of the rsync group.</p> |
| 682 | <p>Finally, options may be specified after a colon (:). The options allow you |
| 683 | to "deny" a user or a group, set the access to "ro" (read-only), or set the |
| 684 | access to "rw" (read/write). Setting an auth-rule-specific ro/rw setting |
| 685 | overrides the module's "<a href="#read_only">read only</a>" setting.</p> |
| 686 | <p>Be sure to put the rules in the order you want them to be matched, because |
| 687 | the checking stops at the first matching user or group, and that is the |
| 688 | only auth that is checked. For example:</p> |
| 689 | <blockquote> |
| 690 | <pre><code>auth users = joe:deny @guest:deny admin:rw @rsync:ro susan joe sam |
| 691 | </code></pre> |
| 692 | </blockquote> |
| 693 | <p>In the above rule, user joe will be denied access no matter what. Any user |
| 694 | that is in the group "guest" is also denied access. The user "admin" gets |
| 695 | access in read/write mode, but only if the admin user is not in group |
| 696 | "guest" (because the admin user-matching rule would never be reached if the |
| 697 | user is in group "guest"). Any other user who is in group "rsync" will get |
| 698 | read-only access. Finally, users susan, joe, and sam get the ro/rw setting |
| 699 | of the module, but only if the user didn't match an earlier group-matching |
| 700 | rule.</p> |
| 701 | <p>If you need to specify a user or group name with a space in it, start your |
| 702 | list with a comma to indicate that the list should only be split on commas |
| 703 | (though leading and trailing whitespace will also be removed, and empty |
| 704 | entries are just ignored). For example:</p> |
| 705 | <blockquote> |
| 706 | <pre><code>auth users = , joe:deny, @Some Group:deny, admin:rw, @RO Group:ro |
| 707 | </code></pre> |
| 708 | </blockquote> |
| 709 | <p>See the description of the secrets file for how you can have per-user |
| 710 | passwords as well as per-group passwords. It also explains how a user can |
| 711 | authenticate using their user password or (when applicable) a group |
| 712 | password, depending on what rule is being authenticated.</p> |
| 713 | <p>See also the section entitled "USING RSYNC-DAEMON FEATURES VIA A REMOTE |
| 714 | SHELL CONNECTION" in <strong>rsync</strong>(1) for information on how handle an |
| 715 | rsyncd.conf-level username that differs from the remote-shell-level |
| 716 | username when using a remote shell to connect to an rsync daemon.</p> |
| 717 | </dd> |
| 718 | |
| 719 | <dt id="secrets_file"><code>secrets file</code><a href="#secrets_file" class="tgt"></a></dt><dd> |
| 720 | <p>This parameter specifies the name of a file that contains the |
| 721 | username:password and/or @groupname:password pairs used for authenticating |
| 722 | this module. This file is only consulted if the "<a href="#auth_users">auth users</a>" parameter is |
| 723 | specified. The file is line-based and contains one name:password pair per |
| 724 | line. Any line has a hash (#) as the very first character on the line is |
| 725 | considered a comment and is skipped. The passwords can contain any |
| 726 | characters but be warned that many operating systems limit the length of |
| 727 | passwords that can be typed at the client end, so you may find that |
| 728 | passwords longer than 8 characters don't work.</p> |
| 729 | <p>The use of group-specific lines are only relevant when the module is being |
| 730 | authorized using a matching "@groupname" rule. When that happens, the user |
| 731 | can be authorized via either their "username:password" line or the |
| 732 | "@groupname:password" line for the group that triggered the authentication.</p> |
| 733 | <p>It is up to you what kind of password entries you want to include, either |
| 734 | users, groups, or both. The use of group rules in "<a href="#auth_users">auth users</a>" does not |
| 735 | require that you specify a group password if you do not want to use shared |
| 736 | passwords.</p> |
| 737 | <p>There is no default for the "secrets file" parameter, you must choose a |
| 738 | name (such as <code>/etc/rsyncd.secrets</code>). Unless "<a href="#strict_modes">strict modes</a>" is |
| 739 | disabled, the file must not be readable or writable by "other", and (when |
| 740 | the daemon runs as root) must be owned by root; see "<a href="#strict_modes">strict modes</a>" for |
| 741 | the exact check. If the file is not found or is rejected, no logins for an |
| 742 | "<a href="#auth_users">auth users</a>" module will be possible.</p> |
| 743 | </dd> |
| 744 | |
| 745 | <dt id="auth_digest"><code>auth digest</code><a href="#auth_digest" class="tgt"></a></dt><dd> |
| 746 | <p>This parameter sets the <u>minimum</u> message digest that the daemon will accept |
| 747 | for the challenge-response authentication of an "<a href="#auth_users">auth users</a>" module. |
| 748 | The available digests, strongest first, are <code>sha512</code>, <code>sha256</code>, <code>sha1</code>, |
| 749 | <code>md5</code>, <code>md4</code>. The daemon selects its own most-preferred digest that also |
| 750 | appears in the connecting client's advertised list (and falls back to <code>md5</code>, |
| 751 | or <code>md4</code> below protocol 30, for a client that advertises none), so a client |
| 752 | that advertises only weak digests can still force a weak negotiated digest. |
| 753 | If it is weaker than the configured |
| 754 | name, the connection is refused before the challenge is sent. The value is a |
| 755 | single digest name, for example:</p> |
| 756 | <blockquote> |
| 757 | <pre><code>auth digest = sha256 |
| 758 | </code></pre> |
| 759 | </blockquote> |
| 760 | <p>which requires <code>sha256</code> or <code>sha512</code> and refuses an <code>md5</code> or <code>md4</code> exchange.</p> |
| 761 | <p>This guards against an <u>auth-digest downgrade</u>. A peer that sends no digest |
| 762 | list (any rsync before 3.2.0, including the openrsync that ships with macOS) |
| 763 | makes the daemon fall back to <code>md5</code> (or <code>md4</code> below protocol 30), and an |
| 764 | on-path attacker can rewrite the unauthenticated negotiation to force the same |
| 765 | weak choice. A captured challenge-response is far cheaper to brute-force |
| 766 | offline against a weak digest, so a site whose clients are all modern can |
| 767 | require a strong one. See the rsync <code>SECURITY.md</code> document for the full |
| 768 | threat model.</p> |
| 769 | <p>There is <strong>no default</strong> -⁠-⁠ the floor is off and the daemon accepts whatever |
| 770 | digest is negotiated, preserving compatibility with older clients. Enabling a |
| 771 | floor refuses every client that cannot offer at least that digest, notably any |
| 772 | rsync older than 3.2.0 (when the SHA digests were added) and the |
| 773 | macOS-bundled openrsync, which authenticate only with <code>md4</code>/<code>md5</code>. The SHA |
| 774 | digests require an rsync built with openssl at both ends; naming a digest this |
| 775 | build does not provide refuses all logins to the module (fail-closed).</p> |
| 776 | <p>Like the other auth parameters, this may be set per module or, for a default |
| 777 | that applies to every module, in the global part of the config file.</p> |
| 778 | </dd> |
| 779 | |
| 780 | <dt id="strict_modes"><code>strict modes</code><a href="#strict_modes" class="tgt"></a></dt><dd> |
| 781 | <p>This parameter determines whether or not the permissions on the secrets |
| 782 | file will be checked. If "strict modes" is true (the default), the secrets |
| 783 | file is rejected if it is readable or writable by "other" (i.e. if any of |
| 784 | the other-read or other-write permission bits is set), and, when the daemon |
| 785 | is running as root, if the file is not owned by root. Group permissions and |
| 786 | the other-execute bit are not consulted, so modes such as 600 or 640 are |
| 787 | accepted while 644 (or any other-readable/-⁠writable mode) is rejected. If |
| 788 | "strict modes" is false, no permission check is performed. This parameter |
| 789 | was added to accommodate rsync running on the Windows operating system.</p> |
| 790 | </dd> |
| 791 | |
| 792 | <dt id="hosts_allow"><code>hosts allow</code><a href="#hosts_allow" class="tgt"></a></dt><dd> |
| 793 | <p>This parameter allows you to specify a list of comma- and/or |
| 794 | whitespace-separated patterns that are matched against a connecting |
| 795 | client's hostname and IP address. If none of the patterns match, then the |
| 796 | connection is rejected.</p> |
| 797 | <p>Each pattern can be in one of six forms:</p> |
| 798 | <ul> |
| 799 | <li>a dotted decimal IPv4 address of the form a.b.c.d, or an IPv6 address of |
| 800 | the form a:b:c::d:e:f. In this case the incoming machine's IP address |
| 801 | must match exactly.</li> |
| 802 | <li>an address/mask in the form ipaddr/n where ipaddr is the IP address and n |
| 803 | is the number of one bits in the netmask. All IP addresses which match |
| 804 | the masked IP address will be allowed in.</li> |
| 805 | <li>an address/mask in the form ipaddr/maskaddr where ipaddr is the IP |
| 806 | address and maskaddr is the netmask in dotted decimal notation for IPv4, |
| 807 | or similar for IPv6, e.g. ffff:ffff:ffff:ffff:: instead of /64. All IP |
| 808 | addresses which match the masked IP address will be allowed in.</li> |
| 809 | <li>a hostname pattern using wildcards. If the hostname of the connecting IP |
| 810 | (as determined by a reverse lookup) matches the wildcarded name (using |
| 811 | the same rules as normal Unix filename matching), the client is allowed |
| 812 | in. This only works if "<a href="#reverse_lookup">reverse lookup</a>" is enabled (the default).</li> |
| 813 | <li>a hostname. A plain hostname is matched against the reverse DNS of the |
| 814 | connecting IP (if "<a href="#reverse_lookup">reverse lookup</a>" is enabled), and/or the IP of the |
| 815 | given hostname is matched against the connecting IP (if "<a href="#forward_lookup">forward lookup</a>" |
| 816 | is enabled, as it is by default). Any match will be allowed in.</li> |
| 817 | <li>an '@' followed by a netgroup name, which will match if the reverse DNS |
| 818 | of the connecting IP is in the specified netgroup.</li> |
| 819 | </ul> |
| 820 | <p>Note IPv6 link-local addresses can have a scope in the address |
| 821 | specification:</p> |
| 822 | <blockquote> |
| 823 | <pre><code>fe80::1%link1 |
| 824 | fe80::%link1/64 |
| 825 | fe80::%link1/ffff:ffff:ffff:ffff:: |
| 826 | </code></pre> |
| 827 | </blockquote> |
| 828 | <p>You can also combine "hosts allow" with "<a href="#hosts_deny">hosts deny</a>" as a way to add |
| 829 | exceptions to your deny list. When both parameters are specified, the |
| 830 | "hosts allow" parameter is checked first and a match results in the client |
| 831 | being able to connect. A non-allowed host is then matched against the |
| 832 | "<a href="#hosts_deny">hosts deny</a>" list to see if it should be rejected. A host that does not |
| 833 | match either list is allowed to connect.</p> |
| 834 | <p>The default is no "hosts allow" parameter, which means all hosts can |
| 835 | connect.</p> |
| 836 | </dd> |
| 837 | |
| 838 | <dt id="hosts_deny"><code>hosts deny</code><a href="#hosts_deny" class="tgt"></a></dt><dd> |
| 839 | <p>This parameter allows you to specify a list of comma- and/or |
| 840 | whitespace-separated patterns that are matched against a connecting clients |
| 841 | hostname and IP address. If the pattern matches then the connection is |
| 842 | rejected. See the "<a href="#hosts_allow">hosts allow</a>" parameter for more information.</p> |
| 843 | <p>The default is no "hosts deny" parameter, which means all hosts can |
| 844 | connect.</p> |
| 845 | </dd> |
| 846 | |
| 847 | <dt id="reverse_lookup"><code>reverse lookup</code><a href="#reverse_lookup" class="tgt"></a></dt><dd> |
| 848 | <p>Controls whether the daemon performs a reverse lookup on the client's IP |
| 849 | address to determine its hostname, which is used for "<a href="#hosts_allow">hosts allow</a>" & |
| 850 | "<a href="#hosts_deny">hosts deny</a>" checks and the "%h" log escape. This is enabled by default, |
| 851 | but you may wish to disable it to save time if you know the lookup will not |
| 852 | return a useful result, in which case the daemon will use the name |
| 853 | "UNDETERMINED" instead.</p> |
| 854 | <p>If this parameter is enabled globally (even by default), rsync performs the |
| 855 | lookup as soon as a client connects, so disabling it for a module will not |
| 856 | avoid the lookup. Thus, you probably want to disable it globally and then |
| 857 | enable it for modules that need the information.</p> |
| 858 | </dd> |
| 859 | |
| 860 | <dt id="forward_lookup"><code>forward lookup</code><a href="#forward_lookup" class="tgt"></a></dt><dd> |
| 861 | <p>Controls whether the daemon performs a forward lookup on any hostname |
| 862 | specified in an hosts allow/deny setting. By default this is enabled, |
| 863 | allowing the use of an explicit hostname that would not be returned by |
| 864 | reverse DNS of the connecting IP.</p> |
| 865 | </dd> |
| 866 | |
| 867 | <dt id="ignore_errors"><code>ignore errors</code><a href="#ignore_errors" class="tgt"></a></dt><dd> |
| 868 | <p>This parameter tells rsyncd to ignore I/O errors on the daemon when |
| 869 | deciding whether to run the delete phase of the transfer. Normally rsync |
| 870 | skips the <code>--delete</code> step if any I/O errors have occurred in order to |
| 871 | prevent disastrous deletion due to a temporary resource shortage or other |
| 872 | I/O error. In some cases this test is counter productive so you can use |
| 873 | this parameter to turn off this behavior.</p> |
| 874 | </dd> |
| 875 | |
| 876 | <dt id="ignore_nonreadable"><code>ignore nonreadable</code><a href="#ignore_nonreadable" class="tgt"></a></dt><dd> |
| 877 | <p>This tells the rsync daemon to completely ignore files that are not |
| 878 | readable by the user. This is useful for public archives that may have some |
| 879 | non-readable files among the directories, and the sysadmin doesn't want |
| 880 | those files to be seen at all.</p> |
| 881 | </dd> |
| 882 | |
| 883 | <dt id="transfer_logging"><code>transfer logging</code><a href="#transfer_logging" class="tgt"></a></dt><dd> |
| 884 | <p>This parameter enables per-file logging of downloads and uploads in a |
| 885 | format somewhat similar to that used by ftp daemons. The daemon always |
| 886 | logs the transfer at the end, so if a transfer is aborted, no mention will |
| 887 | be made in the log file.</p> |
| 888 | <p>If you want to customize the log lines, see the "<a href="#log_format">log format</a>" parameter.</p> |
| 889 | </dd> |
| 890 | |
| 891 | <dt id="log_format"><code>log format</code><a href="#log_format" class="tgt"></a></dt><dd> |
| 892 | <p>This parameter allows you to specify the format used for logging file |
| 893 | transfers when transfer logging is enabled. The format is a text string |
| 894 | containing embedded single-character escape sequences prefixed with a |
| 895 | percent (%) character. An optional numeric field width may also be |
| 896 | specified between the percent and the escape letter (e.g. |
| 897 | "<code>%-50n %8l %07p</code>"). In addition, one or more apostrophes may be specified |
| 898 | prior to a numerical escape to indicate that the numerical value should be |
| 899 | made more human-readable. The 3 supported levels are the same as for the |
| 900 | <code>--human-readable</code> command-line option, though the default is for |
| 901 | human-readability to be off. Each added apostrophe increases the level |
| 902 | (e.g. "<code>%''l %'b %f</code>").</p> |
| 903 | <p>The default log format is "<code>%o %h [%a] %m (%u) %f %l</code>", and a "<code>%t [%p] </code>" |
| 904 | is always prefixed when using the "<a href="#log_file">log file</a>" parameter. (A perl script |
| 905 | that will summarize this default log format is included in the rsync source |
| 906 | code distribution in the "support" subdirectory: rsyncstats.)</p> |
| 907 | <p>The single-character escapes that are understood are as follows:</p> |
| 908 | <ul> |
| 909 | <li>%a the remote IP address (only available for a daemon)</li> |
| 910 | <li>%b the number of bytes actually transferred</li> |
| 911 | <li>%B the permission bits of the file (e.g. rwxrwxrwt)</li> |
| 912 | <li>%c the total size of the block checksums received for the basis file |
| 913 | (only when sending)</li> |
| 914 | <li>%C the full-file checksum if it is known for the file. For older rsync |
| 915 | protocols/versions, the checksum was salted, and is thus not a useful |
| 916 | value (and is not displayed when that is the case). For the checksum to |
| 917 | output for a file, either the <code>--checksum</code> option must be in-effect or |
| 918 | the file must have been transferred without a salted checksum being used. |
| 919 | See the <code>--checksum-choice</code> option for a way to choose the algorithm.</li> |
| 920 | <li>%f the filename (long form on sender; no trailing "/")</li> |
| 921 | <li>%G the gid of the file (decimal) or "DEFAULT"</li> |
| 922 | <li>%h the remote host name (only available for a daemon)</li> |
| 923 | <li>%i an itemized list of what is being updated</li> |
| 924 | <li>%l the length of the file in bytes</li> |
| 925 | <li>%L the string "<code> -> SYMLINK</code>", "<code> => HARDLINK</code>", or "" (where <code>SYMLINK</code> |
| 926 | or <code>HARDLINK</code> is a filename)</li> |
| 927 | <li>%m the module name</li> |
| 928 | <li>%M the last-modified time of the file</li> |
| 929 | <li>%n the filename (short form; trailing "/" on dir)</li> |
| 930 | <li>%o the operation, which is "send", "recv", or "del." (the latter includes |
| 931 | the trailing period)</li> |
| 932 | <li>%p the process ID of this rsync session</li> |
| 933 | <li>%P the module path</li> |
| 934 | <li>%t the current date time</li> |
| 935 | <li>%u the authenticated username or an empty string</li> |
| 936 | <li>%U the uid of the file (decimal)</li> |
| 937 | </ul> |
| 938 | <p>For a list of what the characters mean that are output by "%i", see the |
| 939 | <code>--itemize-changes</code> option in the rsync manpage.</p> |
| 940 | <p>Note that some of the logged output changes when talking with older rsync |
| 941 | versions. For instance, deleted files were only output as verbose messages |
| 942 | prior to rsync 2.6.4.</p> |
| 943 | </dd> |
| 944 | |
| 945 | <dt id="timeout"><code>timeout</code><a href="#timeout" class="tgt"></a></dt><dd> |
| 946 | <p>This parameter allows you to override the clients choice for I/O timeout |
| 947 | for this module. Using this parameter you can ensure that rsync won't wait |
| 948 | on a dead client forever. The timeout is specified in seconds. A value of |
| 949 | zero means no timeout and is the default. A good choice for anonymous rsync |
| 950 | daemons may be 600 (giving a 10 minute timeout).</p> |
| 951 | </dd> |
| 952 | |
| 953 | <dt id="refuse_options"><code>refuse options</code><a href="#refuse_options" class="tgt"></a></dt><dd> |
| 954 | <p>This parameter allows you to specify a space-separated list of rsync |
| 955 | command-line options that will be refused by your rsync daemon. You may |
| 956 | specify the full option name, its one-letter abbreviation, or a wild-card |
| 957 | string that matches multiple options. Beginning in 3.2.0, you can also |
| 958 | negate a match term by starting it with a "!".</p> |
| 959 | <p>When an option is refused, the daemon prints an error message and exits.</p> |
| 960 | <p>For example, this would refuse <code>--checksum</code> (<code>-c</code>) and all the various |
| 961 | delete options:</p> |
| 962 | <blockquote> |
| 963 | <pre><code>refuse options = c delete |
| 964 | </code></pre> |
| 965 | </blockquote> |
| 966 | <p>The reason the above refuses all delete options is that the options imply |
| 967 | <code>--delete</code>, and implied options are refused just like explicit options.</p> |
| 968 | <p>The use of a negated match allows you to fine-tune your refusals after a |
| 969 | wild-card, such as this:</p> |
| 970 | <blockquote> |
| 971 | <pre><code>refuse options = delete-* !delete-during |
| 972 | </code></pre> |
| 973 | </blockquote> |
| 974 | <p>Negated matching can also turn your list of refused options into a list of |
| 975 | accepted options. To do this, begin the list with a "<code>*</code>" (to refuse all |
| 976 | options) and then specify one or more negated matches to accept. For |
| 977 | example:</p> |
| 978 | <blockquote> |
| 979 | <pre><code>refuse options = * !a !v !compress* |
| 980 | </code></pre> |
| 981 | </blockquote> |
| 982 | <p>Don't worry that the "<code>*</code>" will refuse certain vital options such as |
| 983 | <code>--dry-run</code>, <code>--server</code>, <code>--no-iconv</code>, <code>--seclude-args</code>, etc. These |
| 984 | important options are not matched by wild-card, so they must be overridden |
| 985 | by their exact name. For instance, if you're forcing iconv transfers you |
| 986 | could use something like this:</p> |
| 987 | <blockquote> |
| 988 | <pre><code>refuse options = * no-iconv !a !v |
| 989 | </code></pre> |
| 990 | </blockquote> |
| 991 | <p>As an additional aid (beginning in 3.2.0), refusing (or "<code>!refusing</code>") the |
| 992 | "a" or "archive" option also affects all the options that the <code>--archive</code> |
| 993 | option implies (<code>-rdlptgoD</code>), but only if the option is matched explicitly |
| 994 | (not using a wildcard). If you want to do something tricky, you can use |
| 995 | "<code>archive*</code>" to avoid this side-effect, but keep in mind that no normal |
| 996 | rsync client ever sends the actual archive option to the server.</p> |
| 997 | <p>As an additional safety feature, the refusal of "delete" also refuses |
| 998 | <code>remove-source-files</code> when the daemon is the sender; if you want the latter |
| 999 | without the former, instead refuse "<code>delete-*</code>" as that refuses all the |
| 1000 | delete modes without affecting <code>--remove-source-files</code>. (Keep in mind that |
| 1001 | the client's <code>--delete</code> option typically results in <code>--delete-during</code>.)</p> |
| 1002 | <p>When un-refusing delete options, you should either specify "<code>!delete*</code>" (to |
| 1003 | accept all delete options) or specify a limited set that includes "delete", |
| 1004 | such as:</p> |
| 1005 | <blockquote> |
| 1006 | <pre><code>refuse options = * !a !delete !delete-during |
| 1007 | </code></pre> |
| 1008 | </blockquote> |
| 1009 | <p>... whereas this accepts any delete option except <code>--delete-after</code>:</p> |
| 1010 | <blockquote> |
| 1011 | <pre><code>refuse options = * !a !delete* delete-after |
| 1012 | </code></pre> |
| 1013 | </blockquote> |
| 1014 | <p>A note on refusing "compress": it may be better to set the "<a href="#dont_compress">dont compress</a>" |
| 1015 | daemon parameter to "<code>*</code>" and ensure that <code>RSYNC_COMPRESS_LIST=zlib</code> is set |
| 1016 | in the environment of the daemon in order to disable compression silently |
| 1017 | instead of returning an error that forces the client to remove the <code>-z</code> |
| 1018 | option.</p> |
| 1019 | <p>If you are un-refusing the compress option, you may want to match |
| 1020 | "<code>!compress*</code>" if you also want to allow the <code>--compress-level</code> option.</p> |
| 1021 | <p>Note that the "copy-devices" & "write-devices" options are refused by |
| 1022 | default, but they can be explicitly accepted with "<code>!copy-devices</code>" and/or |
| 1023 | "<code>!write-devices</code>". The options "log-file" and "log-file-format" are |
| 1024 | forcibly refused and cannot be accepted.</p> |
| 1025 | <p>Here are all the options that are not matched by wild-cards:</p> |
| 1026 | <ul> |
| 1027 | <li><code>--server</code>: Required for rsync to even work.</li> |
| 1028 | <li><code>--rsh</code>, <code>-e</code>: Required to convey compatibility flags to the server.</li> |
| 1029 | <li><code>--out-format</code>: This is required to convey output behavior to a remote |
| 1030 | receiver. While rsync passes the older alias <code>--log-format</code> for |
| 1031 | compatibility reasons, this options should not be confused with |
| 1032 | <code>--log-file-format</code>.</li> |
| 1033 | <li><code>--sender</code>: Use "<a href="#write_only">write only</a>" parameter instead of refusing this.</li> |
| 1034 | <li><code>--dry-run</code>, <code>-n</code>: Who would want to disable this?</li> |
| 1035 | <li><code>--seclude-args</code>, <code>-s</code>: Is the oldest arg-protection method.</li> |
| 1036 | <li><code>--from0</code>, <code>-0</code>: Makes it easier to accept/refuse <code>--files-from</code> without |
| 1037 | affecting this helpful modifier.</li> |
| 1038 | <li><code>--iconv</code>: This is auto-disabled based on "<a href="#charset">charset</a>" parameter.</li> |
| 1039 | <li><code>--no-iconv</code>: Most transfers use this option.</li> |
| 1040 | <li><code>--checksum-seed</code>: Is a fairly rare, safe option.</li> |
| 1041 | <li><code>--write-devices</code>: Is non-wild but also auto-disabled.</li> |
| 1042 | </ul> |
| 1043 | </dd> |
| 1044 | |
| 1045 | <dt id="dont_compress"><code>dont compress</code><a href="#dont_compress" class="tgt"></a></dt><dd> |
| 1046 | <p><strong>NOTE:</strong> This parameter currently has no effect except in one instance: if |
| 1047 | it is set to "<code>*</code>" then it minimizes or disables compression for all files |
| 1048 | (for those that don't want to refuse the <code>--compress</code> option completely).</p> |
| 1049 | <p>This parameter allows you to select filenames based on wildcard patterns |
| 1050 | that should not be compressed when pulling files from the daemon (no |
| 1051 | analogous parameter exists to govern the pushing of files to a daemon). |
| 1052 | Compression can be expensive in terms of CPU usage, so it is usually good |
| 1053 | to not try to compress files that won't compress well, such as already |
| 1054 | compressed files.</p> |
| 1055 | <p>The "dont compress" parameter takes a space-separated list of |
| 1056 | case-insensitive wildcard patterns. Any source filename matching one of the |
| 1057 | patterns will be compressed as little as possible during the transfer. If |
| 1058 | the compression algorithm has an "off" level, then no compression occurs |
| 1059 | for those files. If an algorithms has the ability to change the level in |
| 1060 | mid-stream, it will be minimized to reduce the CPU usage as much as |
| 1061 | possible.</p> |
| 1062 | <p>See the <code>--skip-compress</code> parameter in the <strong>rsync</strong>(1) manpage for the |
| 1063 | list of file suffixes that are skipped by default if this parameter is not |
| 1064 | set.</p> |
| 1065 | </dd> |
| 1066 | |
| 1067 | <span id="post-xfer_exec"></span><span id="pre-xfer_exec"></span><dt id="early_exec"><code>early exec</code>, <code>pre-xfer exec</code>, <code>post-xfer exec</code><a href="#early_exec" class="tgt"></a></dt><dd> |
| 1068 | <p>You may specify a command to be run in the early stages of the connection, |
| 1069 | or right before and/or after the transfer. If the <code>early exec</code> or |
| 1070 | <code>pre-xfer exec</code> command returns an error code, the transfer is aborted |
| 1071 | before it begins. Any output from the <code>pre-xfer exec</code> command on stdout |
| 1072 | (up to several KB) will be displayed to the user when aborting, but is |
| 1073 | <u>not</u> displayed if the script returns success. The other programs cannot |
| 1074 | send any text to the user. All output except for the <code>pre-xfer exec</code> |
| 1075 | stdout goes to the corresponding daemon's stdout/stderr, which is typically |
| 1076 | discarded. See the <code>--no-detach</code> option for a way to see the daemon's |
| 1077 | output, which can assist with debugging.</p> |
| 1078 | <p>Note that the <code>early exec</code> command runs before any part of the transfer |
| 1079 | request is known except for the module name. This helper script can be |
| 1080 | used to setup a disk mount or decrypt some data into a module dir, but you |
| 1081 | may need to use <code>lock file</code> and <code>max connections</code> to avoid concurrency |
| 1082 | issues. If the client rsync specified the <code>--early-input=FILE</code> option, it |
| 1083 | can send up to about 5K of data to the stdin of the early script. The |
| 1084 | stdin will otherwise be empty.</p> |
| 1085 | <p>Note that the <code>post-xfer exec</code> command is still run even if one of the |
| 1086 | other scripts returns an error code. The <code>pre-xfer exec</code> command will <u>not</u> |
| 1087 | be run, however, if the <code>early exec</code> command fails.</p> |
| 1088 | <p>The following environment variables will be set, though some are specific |
| 1089 | to the pre-xfer or the post-xfer environment:</p> |
| 1090 | <ul> |
| 1091 | <li><code>RSYNC_MODULE_NAME</code>: The name of the module being accessed.</li> |
| 1092 | <li><code>RSYNC_MODULE_PATH</code>: The path configured for the module.</li> |
| 1093 | <li><code>RSYNC_HOST_ADDR</code>: The accessing host's IP address.</li> |
| 1094 | <li><code>RSYNC_HOST_NAME</code>: The accessing host's name.</li> |
| 1095 | <li><code>RSYNC_USER_NAME</code>: The accessing user's name (empty if no user).</li> |
| 1096 | <li><code>RSYNC_PID</code>: A unique number for this transfer.</li> |
| 1097 | <li><code>RSYNC_REQUEST</code>: (pre-xfer only) The module/path info specified by the |
| 1098 | user. Note that the user can specify multiple source files, so the |
| 1099 | request can be something like "mod/path1 mod/path2", etc.</li> |
| 1100 | <li><code>RSYNC_ARG#</code>: (pre-xfer only) The pre-request arguments are set in these |
| 1101 | numbered values. RSYNC_ARG0 is always "rsyncd", followed by the options |
| 1102 | that were used in RSYNC_ARG1, and so on. There will be a value of "." |
| 1103 | indicating that the options are done and the path args are beginning -⁠-⁠ |
| 1104 | these contain similar information to RSYNC_REQUEST, but with values |
| 1105 | separated and the module name stripped off.</li> |
| 1106 | <li><code>RSYNC_EXIT_STATUS</code>: (post-xfer only) the server side's exit value. This |
| 1107 | will be 0 for a successful run, a positive value for an error that the |
| 1108 | server generated, or a -⁠1 if rsync failed to exit properly. Note that an |
| 1109 | error that occurs on the client side does not currently get sent to the |
| 1110 | server side, so this is not the final exit status for the whole transfer.</li> |
| 1111 | <li><code>RSYNC_RAW_STATUS</code>: (post-xfer only) the raw exit value from |
| 1112 | <strong>waitpid()</strong>.</li> |
| 1113 | </ul> |
| 1114 | <p>A <code>%VAR%</code> reference expanded into one of these commands is escaped for the |
| 1115 | quoting context it appears in, which is correct for the single shell that |
| 1116 | runs the command. It is not correct for a command that starts a SECOND |
| 1117 | shell, such as <code>sh -c '... %RSYNC_USER_NAME% ...'</code>: the outer shell consumes |
| 1118 | the escaping, and the inner one sees the value bare. A value of <code>touc?</code> |
| 1119 | would then be glob-expanded against <code>/usr/bin/</code>, so the substitution is not |
| 1120 | data any more -⁠-⁠ it chooses the command.</p> |
| 1121 | <p>Because rsync cannot escape for an unknown number of shell passes, a value |
| 1122 | carrying any character that a shell could act on is refused outright, and |
| 1123 | the transfer is aborted with</p> |
| 1124 | <blockquote> |
| 1125 | <pre><code>refusing to run shell hook: %VAR% holds a shell metacharacter |
| 1126 | </code></pre> |
| 1127 | </blockquote> |
| 1128 | <p>The refused characters are whitespace, the quoting and expansion characters |
| 1129 | <code>'</code> <code>"</code> <code>`</code> <code>$</code> <code>\</code>, the separators <code>;</code> <code>&</code> <code>|</code>, redirections <code><</code> <code>></code>, |
| 1130 | parentheses, the pattern characters <code>*</code> <code>?</code> <code>[</code> <code>]</code>, <code>#</code>, <code>!</code>, <code>~</code>, <code>{</code> <code>}</code>, |
| 1131 | and any control character. Some of those are harmless on their own and are |
| 1132 | refused for what a <u>second</u> shell would do with them -⁠-⁠ <code>!</code> negates in |
| 1133 | command position, so a hook written as an access check can be turned from a |
| 1134 | denial into an approval, and <code>~</code> is tilde-expanded.</p> |
| 1135 | <p>This applies to EVERY <code>%RSYNC_*%</code> value, including ones you supplied |
| 1136 | yourself. In particular a module whose <code>path</code> contains any of them cannot |
| 1137 | be interpolated into one of these commands: <code>path = /srv/My Backups</code> with a command mentioning |
| 1138 | <code>%RSYNC_MODULE_PATH%</code> will refuse every transfer of that module, not just a |
| 1139 | hostile one. The restriction is deliberate -⁠-⁠ rsync cannot tell your space |
| 1140 | from an attacker's once both are inside the same string, and <code>path</code> itself |
| 1141 | may be built from a peer value such as <code>path = /home/%RSYNC_USER_NAME%</code>.</p> |
| 1142 | <p>If you need such a value in a hook, pass it through the environment instead |
| 1143 | of interpolating it: the same names are exported to the command, so |
| 1144 | <code>"$RSYNC_MODULE_PATH"</code> inside your script is unrestricted by this check. |
| 1145 | Quote it there as shown -⁠-⁠ rsync no longer has any say in how your script |
| 1146 | splits the value.</p> |
| 1147 | <p>Even though the commands can be associated with a particular module, they |
| 1148 | are run using the permissions of the user that started the daemon (not the |
| 1149 | module's uid/gid setting) without any chroot restrictions.</p> |
| 1150 | <p>These settings honor 2 environment variables: use RSYNC_SHELL to set a |
| 1151 | shell to use when running the command (which otherwise uses your |
| 1152 | <strong>system()</strong> call's default shell), and use RSYNC_NO_XFER_EXEC to disable |
| 1153 | both options completely.</p> |
| 1154 | </dd> |
| 1155 | |
| 1156 | <dt id="temp_dir"><code>temp dir</code><a href="#temp_dir" class="tgt"></a></dt><dd> |
| 1157 | <p>Specifies a directory that rsync should use for temporary files created |
| 1158 | during the transfer of updated files. If that directory is on a different |
| 1159 | partition, after transfer file is being copied instead of unlinked.</p> |
| 1160 | <p>This parameter equals with <code>--temp-dir</code> option, so please consult rsync |
| 1161 | manpage for further information.</p> |
| 1162 | </dd> |
| 1163 | </dl> |
| 1164 | <h2 id="CONFIG_DIRECTIVES">CONFIG DIRECTIVES<a href="#CONFIG_DIRECTIVES" class="tgt"></a></h2> |
| 1165 | <p>There are currently two config directives available that allow a config file to |
| 1166 | incorporate the contents of other files: <code>&include</code> and <code>&merge</code>. Both allow |
| 1167 | a reference to either a file or a directory. They differ in how segregated the |
| 1168 | file's contents are considered to be.</p> |
| 1169 | <p>The <code>&include</code> directive treats each file as more distinct, with each one |
| 1170 | inheriting the defaults of the parent file, starting the parameter parsing as |
| 1171 | globals/defaults, and leaving the defaults unchanged for the parsing of the |
| 1172 | rest of the parent file.</p> |
| 1173 | <p>The <code>&merge</code> directive, on the other hand, treats the file's contents as if it |
| 1174 | were simply inserted in place of the directive, and thus it can set parameters |
| 1175 | in a module started in another file, can affect the defaults for other files, |
| 1176 | etc.</p> |
| 1177 | <p>When an <code>&include</code> or <code>&merge</code> directive refers to a directory, it will read in |
| 1178 | all the <code>*.conf</code> or <code>*.inc</code> files (respectively) that are contained inside that |
| 1179 | directory (without any recursive scanning), with the files sorted into alpha |
| 1180 | order. So, if you have a directory named "rsyncd.d" with the files "foo.conf", |
| 1181 | "bar.conf", and "baz.conf" inside it, this directive:</p> |
| 1182 | <blockquote> |
| 1183 | <pre><code>&include /path/rsyncd.d |
| 1184 | </code></pre> |
| 1185 | </blockquote> |
| 1186 | <p>would be the same as this set of directives:</p> |
| 1187 | <blockquote> |
| 1188 | <pre><code>&include /path/rsyncd.d/bar.conf |
| 1189 | &include /path/rsyncd.d/baz.conf |
| 1190 | &include /path/rsyncd.d/foo.conf |
| 1191 | </code></pre> |
| 1192 | </blockquote> |
| 1193 | <p>except that it adjusts as files are added and removed from the directory.</p> |
| 1194 | <p>The advantage of the <code>&include</code> directive is that you can define one or more |
| 1195 | modules in a separate file without worrying about unintended side-effects |
| 1196 | between the self-contained module files.</p> |
| 1197 | <p>The advantage of the <code>&merge</code> directive is that you can load config snippets |
| 1198 | that can be included into multiple module definitions, and you can also set |
| 1199 | global values that will affect connections (such as <code>motd file</code>), or globals |
| 1200 | that will affect other include files.</p> |
| 1201 | <p>For example, this is a useful /etc/rsyncd.conf file:</p> |
| 1202 | <blockquote> |
| 1203 | <pre><code>port = 873 |
| 1204 | log file = /var/log/rsync.log |
| 1205 | pid file = /var/lock/rsync.lock |
| 1206 | |
| 1207 | &merge /etc/rsyncd.d |
| 1208 | &include /etc/rsyncd.d |
| 1209 | </code></pre> |
| 1210 | </blockquote> |
| 1211 | <p>This would merge any <code>/etc/rsyncd.d/*.inc</code> files (for global values that should |
| 1212 | stay in effect), and then include any <code>/etc/rsyncd.d/*.conf</code> files (defining |
| 1213 | modules without any global-value cross-talk).</p> |
| 1214 | <h2 id="SECURITY">SECURITY<a href="#SECURITY" class="tgt"></a></h2> |
| 1215 | <p>An rsync daemon exposes part of your filesystem to network clients, and its |
| 1216 | master process usually runs as root, so it should be configured defensively. |
| 1217 | The following is a practical checklist; the project's <code>SECURITY.md</code> describes the |
| 1218 | underlying threat model and the per-platform residuals.</p> |
| 1219 | <dl> |
| 1220 | |
| 1221 | <span id="t_inner"></span><span id="t_outer"></span><span id="path-2"></span><dt id="Confine_each_module_to_its_path."><strong>Confine each module to its path.</strong> |
| 1222 | Leave "<a href="#use_chroot">use chroot</a>" enabled (the default attempts a chroot) so the |
| 1223 | per-connection worker is jailed inside the module's "<a href="#path">path</a>". Where chroot |
| 1224 | is unavailable rsync still resolves every transfer path so it cannot escape |
| 1225 | the module through a symlinked parent, but a chroot is the stronger boundary -⁠-⁠ keep it on unless you have a specific reason not to. A <code>path = /outer/./inner</code> chroots to <code>/outer</code> while serving <code>/inner</code> as the module root.<a href="#Confine_each_module_to_its_path." class="tgt"></a></dt><dd> |
| 1226 | </dd> |
| 1227 | |
| 1228 | <dt id="Drop_privileges."><strong>Drop privileges.</strong> |
| 1229 | Give each module a low-privilege "<a href="#uid">uid</a>" and "<a href="#gid">gid</a>" so a worker never |
| 1230 | serves files as root; only the master process needs root (to chroot and bind |
| 1231 | the port). Keep modules "<a href="#read_only">read only</a>" unless they must accept uploads, and |
| 1232 | prefer "<a href="#numeric_ids">numeric ids</a>" (or a "<a href="#name_converter">name converter</a>") so a malicious file |
| 1233 | list cannot map files to an unexpected local owner.<a href="#Drop_privileges." class="tgt"></a></dt><dd> |
| 1234 | </dd> |
| 1235 | |
| 1236 | <dt id="Restrict_who_can_connect."><strong>Restrict who can connect.</strong> |
| 1237 | Limit reachability with "<a href="#hosts_allow">hosts allow</a>" / "<a href="#hosts_deny">hosts deny</a>", bind the |
| 1238 | daemon to a specific "<a href="#address">address</a>", and use a host firewall. A module |
| 1239 | without "<a href="#auth_users">auth users</a>" is reachable by anyone who can reach the port.<a href="#Restrict_who_can_connect." class="tgt"></a></dt><dd> |
| 1240 | </dd> |
| 1241 | |
| 1242 | <span id="auth_digest-2"></span><dt id="Authenticate_with_a_strong_secret_and_digest."><strong>Authenticate with a strong secret and digest.</strong> |
| 1243 | Require login with "<a href="#auth_users">auth users</a>" plus a "<a href="#secrets_file">secrets file</a>" that is |
| 1244 | readable only by the daemon user (rsync refuses a too-open file unless |
| 1245 | "<a href="#strict_modes">strict modes</a>" is disabled), and use a long, high-entropy secret. To |
| 1246 | refuse the weak MD4/MD5 challenge digests that old clients can negotiate, set |
| 1247 | a floor with "<a href="#auth_digest">auth digest</a>" (for example <code>auth digest = sha512</code>); see the |
| 1248 | AUTHENTICATION STRENGTH section below.<a href="#Authenticate_with_a_strong_secret_and_digest." class="tgt"></a></dt><dd> |
| 1249 | </dd> |
| 1250 | |
| 1251 | <span id="not"></span><dt id="Encrypt_the_connection."><strong>Encrypt the connection.</strong> |
| 1252 | The daemon protocol authenticates but does <strong>not</strong> encrypt the data stream. |
| 1253 | Do not expose a cleartext daemon to an untrusted network: front it with a TLS |
| 1254 | proxy (see the SSL/TLS Daemon Setup section below) or run it over ssh.<a href="#Encrypt_the_connection." class="tgt"></a></dt><dd> |
| 1255 | </dd> |
| 1256 | |
| 1257 | <span id="not-2"></span><dt id="Keep_symlink_handling_safe."><strong>Keep symlink handling safe.</strong> |
| 1258 | Leave "<a href="#munge_symlinks">munge symlinks</a>" enabled on any writable module (it is the default) |
| 1259 | so an uploaded symlink cannot redirect a later operation outside the module. |
| 1260 | Do <strong>not</strong> set "<a href="#insecure_links">insecure links</a> = yes" on a host shared with untrusted |
| 1261 | local users: it disables the daemon's symlink-escape protections (re-opening |
| 1262 | the symlink TOCTOU/escape vulnerabilities, including CVE-2026-53797 and |
| 1263 | CVE-2026-53801) and is appropriate only on a single-tenant, fully isolated |
| 1264 | host.<a href="#Keep_symlink_handling_safe." class="tgt"></a></dt><dd> |
| 1265 | </dd> |
| 1266 | |
| 1267 | <dt id="Refuse_options_you_do_not_want."><strong>Refuse options you do not want.</strong> |
| 1268 | Use "<a href="#refuse_options">refuse options</a>" to reject client options a module should not allow.<a href="#Refuse_options_you_do_not_want." class="tgt"></a></dt><dd> |
| 1269 | </dd> |
| 1270 | </dl> |
| 1271 | <h2 id="AUTHENTICATION_STRENGTH">AUTHENTICATION STRENGTH<a href="#AUTHENTICATION_STRENGTH" class="tgt"></a></h2> |
| 1272 | <p>Daemon authentication is a challenge-response system in which the client |
| 1273 | returns a digest of the shared secret and a server-chosen challenge. Modern |
| 1274 | rsync (3.2.7 and later, built with openssl) negotiates the strongest digest both |
| 1275 | sides support -⁠-⁠ <code>sha512</code> by default -⁠-⁠ but for backward compatibility it falls |
| 1276 | back to <code>md5</code> (or <code>md4</code> below protocol 30) for a client that advertises no digest |
| 1277 | list, and the digest negotiation is itself unauthenticated. A daemon that wants |
| 1278 | to require a strong digest can set "<a href="#auth_digest">auth digest</a>". For the best protection, |
| 1279 | run rsync over ssh or a verified TLS transport (<code>rsync-ssl</code>), which protects the |
| 1280 | exchange at the transport layer, and use a high-entropy shared secret (which is |
| 1281 | infeasible to brute-force regardless of the digest).</p> |
| 1282 | <p>Also note that the rsync daemon protocol does not currently provide any |
| 1283 | encryption of the data that is transferred over the connection. Only |
| 1284 | authentication is provided. Use ssh as the transport if you want encryption.</p> |
| 1285 | <p>You can also make use of SSL/TLS encryption if you put rsync behind an |
| 1286 | SSL proxy.</p> |
| 1287 | <h2 id="SSL_TLS_Daemon_Setup">SSL/TLS Daemon Setup<a href="#SSL_TLS_Daemon_Setup" class="tgt"></a></h2> |
| 1288 | <p>When setting up an rsync daemon for access via SSL/TLS, you will need to |
| 1289 | configure a TCP proxy (such as haproxy or nginx) as the front-end that handles |
| 1290 | the encryption.</p> |
| 1291 | <ul> |
| 1292 | <li>You should limit the access to the backend-rsyncd port to only allow the |
| 1293 | proxy to connect. If it is on the same host as the proxy, then configuring |
| 1294 | it to only listen on localhost is a good idea.</li> |
| 1295 | <li>You should consider turning on the <code>proxy protocol</code> rsync-daemon parameter if |
| 1296 | your proxy supports sending that information. The examples below assume that |
| 1297 | this is enabled.</li> |
| 1298 | </ul> |
| 1299 | <p>An example haproxy setup is as follows:</p> |
| 1300 | <blockquote> |
| 1301 | <pre><code>frontend fe_rsync-ssl |
| 1302 | bind :::874 ssl crt /etc/letsencrypt/example.com/combined.pem |
| 1303 | mode tcp |
| 1304 | use_backend be_rsync |
| 1305 | |
| 1306 | backend be_rsync |
| 1307 | mode tcp |
| 1308 | server local-rsync 127.0.0.1:873 check send-proxy |
| 1309 | </code></pre> |
| 1310 | </blockquote> |
| 1311 | <p>An example nginx proxy setup is as follows:</p> |
| 1312 | <blockquote> |
| 1313 | <pre><code>stream { |
| 1314 | server { |
| 1315 | listen 874 ssl; |
| 1316 | listen [::]:874 ssl; |
| 1317 | |
| 1318 | ssl_certificate /etc/letsencrypt/example.com/fullchain.pem; |
| 1319 | ssl_certificate_key /etc/letsencrypt/example.com/privkey.pem; |
| 1320 | |
| 1321 | proxy_pass localhost:873; |
| 1322 | proxy_protocol on; # Requires rsyncd.conf "proxy protocol = true" |
| 1323 | proxy_timeout 1m; |
| 1324 | proxy_connect_timeout 5s; |
| 1325 | } |
| 1326 | } |
| 1327 | </code></pre> |
| 1328 | </blockquote> |
| 1329 | <p>If rsyncd should be accessible encrypted and unencrypted at the same time make |
| 1330 | the proxy listen on port 873 as well and let it handle both streams.</p> |
| 1331 | <h2 id="DAEMON_CONFIG_EXAMPLES">DAEMON CONFIG EXAMPLES<a href="#DAEMON_CONFIG_EXAMPLES" class="tgt"></a></h2> |
| 1332 | <p>A simple rsyncd.conf file that allow anonymous rsync to a ftp area at |
| 1333 | <code>/home/ftp</code> would be:</p> |
| 1334 | <blockquote> |
| 1335 | <pre><code>[ftp] |
| 1336 | path = /home/ftp |
| 1337 | comment = ftp export area |
| 1338 | </code></pre> |
| 1339 | </blockquote> |
| 1340 | <p>A more sophisticated example would be:</p> |
| 1341 | <blockquote> |
| 1342 | <pre><code>uid = nobody |
| 1343 | gid = nobody |
| 1344 | use chroot = yes |
| 1345 | max connections = 4 |
| 1346 | syslog facility = local5 |
| 1347 | pid file = /var/run/rsyncd.pid |
| 1348 | |
| 1349 | [ftp] |
| 1350 | path = /var/ftp/./pub |
| 1351 | comment = whole ftp area (approx 6.1 GB) |
| 1352 | |
| 1353 | [sambaftp] |
| 1354 | path = /var/ftp/./pub/samba |
| 1355 | comment = Samba ftp area (approx 300 MB) |
| 1356 | |
| 1357 | [rsyncftp] |
| 1358 | path = /var/ftp/./pub/rsync |
| 1359 | comment = rsync ftp area (approx 6 MB) |
| 1360 | |
| 1361 | [sambawww] |
| 1362 | path = /public_html/samba |
| 1363 | comment = Samba WWW pages (approx 240 MB) |
| 1364 | |
| 1365 | [cvs] |
| 1366 | path = /data/cvs |
| 1367 | comment = CVS repository (requires authentication) |
| 1368 | auth users = tridge, susan |
| 1369 | secrets file = /etc/rsyncd.secrets |
| 1370 | </code></pre> |
| 1371 | </blockquote> |
| 1372 | <p>The /etc/rsyncd.secrets file would look something like this:</p> |
| 1373 | <blockquote> |
| 1374 | <pre><code>tridge:mypass |
| 1375 | susan:herpass |
| 1376 | </code></pre> |
| 1377 | </blockquote> |
| 1378 | <h2 id="FILES">FILES<a href="#FILES" class="tgt"></a></h2> |
| 1379 | <p>/etc/rsyncd.conf or rsyncd.conf</p> |
| 1380 | <h2 id="SEE_ALSO">SEE ALSO<a href="#SEE_ALSO" class="tgt"></a></h2> |
| 1381 | <p><a href="rsync.1"><strong>rsync</strong>(1)</a>, <a href="rsync-ssl.1"><strong>rsync-ssl</strong>(1)</a></p> |
| 1382 | <h2 id="BUGS">BUGS<a href="#BUGS" class="tgt"></a></h2> |
| 1383 | <p>Please report bugs! The rsync bug tracking system is online at |
| 1384 | <a href="https://rsync.samba.org/">https://rsync.samba.org/</a>.</p> |
| 1385 | <h2 id="VERSION">VERSION<a href="#VERSION" class="tgt"></a></h2> |
| 1386 | <p>This manpage is current for version 3.5.0 of rsync.</p> |
| 1387 | <h2 id="CREDITS">CREDITS<a href="#CREDITS" class="tgt"></a></h2> |
| 1388 | <p>Rsync is distributed under the GNU General Public License. See the file |
| 1389 | <a href="COPYING">COPYING</a> for details.</p> |
| 1390 | <p>An rsync web site is available at <a href="https://rsync.samba.org/">https://rsync.samba.org/</a> and its github |
| 1391 | project is <a href="https://github.com/RsyncProject/rsync">https://github.com/RsyncProject/rsync</a>.</p> |
| 1392 | <h2 id="THANKS">THANKS<a href="#THANKS" class="tgt"></a></h2> |
| 1393 | <p>Thanks to Warren Stanley for his original idea and patch for the rsync daemon. |
| 1394 | Thanks to Karsten Thygesen for his many suggestions and documentation!</p> |
| 1395 | <h2 id="AUTHOR">AUTHOR<a href="#AUTHOR" class="tgt"></a></h2> |
| 1396 | <p>Rsync was originally written by Andrew Tridgell and Paul Mackerras. Many |
| 1397 | people from around the world have helped to maintain and improve it.</p> |
| 1398 | <p>Special thanks go to Wayne Davison, who maintained rsync from 2004 to 2024.</p> |
| 1399 | <p>Mailing lists for support and development are available at |
| 1400 | <a href="https://lists.samba.org/">https://lists.samba.org/</a>.</p> |
| 1401 | <div style="float: right"><p><i>13 Aug 2026</i></p></div> |
| 1402 | </body></html> |