Debian Codegraph @

rsyncd.conf.5.md

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