1rsyncd.conf(5) rsyncd.conf(5)
2
3
4
6 rsyncd.conf - configuration file for rsync in daemon mode
7
9 rsyncd.conf
10
12 The rsyncd.conf file is the runtime configuration file for rsync when
13 run as an rsync daemon.
14
15 The rsyncd.conf file controls authentication, access, logging and
16 available modules.
17
19 The file consists of modules and parameters. A module begins with the
20 name of the module in square brackets and continues until the next mod‐
21 ule begins. Modules contain parameters of the form "name = value".
22
23 The file is line-based -- that is, each newline-terminated line repre‐
24 sents either a comment, a module name or a parameter.
25
26 Only the first equals sign in a parameter is significant. Whitespace
27 before or after the first equals sign is discarded. Leading, trailing
28 and internal whitespace in module and parameter names is irrelevant.
29 Leading and trailing whitespace in a parameter value is discarded.
30 Internal whitespace within a parameter value is retained verbatim.
31
32 Any line beginning with a hash (#) is ignored, as are lines containing
33 only whitespace. (If a hash occurs after anything other than leading
34 whitespace, it is considered a part of the line’s content.)
35
36 Any line ending in a \ is "continued" on the next line in the customary
37 UNIX fashion.
38
39 The values following the equals sign in parameters are all either a
40 string (no quotes needed) or a boolean, which may be given as yes/no,
41 0/1 or true/false. Case is not significant in boolean values, but is
42 preserved in string values.
43
45 The rsync daemon is launched by specifying the --daemon option to
46 rsync.
47
48 The daemon must run with root privileges if you wish to use chroot, to
49 bind to a port numbered under 1024 (as is the default 873), or to set
50 file ownership. Otherwise, it must just have permission to read and
51 write the appropriate data, log, and lock files.
52
53 You can launch it either via inetd, as a stand-alone daemon, or from an
54 rsync client via a remote shell. If run as a stand-alone daemon then
55 just run the command "rsync --daemon" from a suitable startup script.
56
57 When run via inetd you should add a line like this to /etc/services:
58
59 rsync 873/tcp
60
61
62 and a single line something like this to /etc/inetd.conf:
63
64 rsync stream tcp nowait root /usr/bin/rsync rsyncd --daemon
65
66
67 Replace "/usr/bin/rsync" with the path to where you have rsync
68 installed on your system. You will then need to send inetd a HUP sig‐
69 nal to tell it to reread its config file.
70
71 Note that you should not send the rsync daemon a HUP signal to force it
72 to reread the rsyncd.conf file. The file is re-read on each client con‐
73 nection.
74
76 The first parameters in the file (before a [module] header) are the
77 global parameters. Rsync also allows for the use of a "[global]" mod‐
78 ule name to indicate the start of one or more global-parameter sections
79 (the name must be lower case).
80
81 You may also include any module parameters in the global part of the
82 config file in which case the supplied value will override the default
83 for that parameter.
84
85 You may use references to environment variables in the values of param‐
86 eters. String parameters will have %VAR% references expanded as late
87 as possible (when the string is used in the program), allowing for the
88 use of variables that rsync sets at connection time, such as
89 RSYNC_USER_NAME. Non-string parameters (such as true/false settings)
90 are expanded when read from the config file. If a variable does not
91 exist in the environment, or if a sequence of characters is not a valid
92 reference (such as an un-paired percent sign), the raw characters are
93 passed through unchanged. This helps with backward compatibility and
94 safety (e.g. expanding a non-existent %VAR% to an empty string in a
95 path could result in a very unsafe path). The safest way to insert a
96 literal % into a value is to use %%.
97
98 motd file
99 This parameter allows you to specify a "message of the day" to
100 display to clients on each connect. This usually contains site
101 information and any legal notices. The default is no motd file.
102 This can be overridden by the --dparam=motdfile=FILE com‐
103 mand-line option when starting the daemon.
104
105 pid file
106 This parameter tells the rsync daemon to write its process ID to
107 that file. If the file already exists, the rsync daemon will
108 abort rather than overwrite the file. This can be overridden by
109 the --dparam=pidfile=FILE command-line option when starting the
110 daemon.
111
112 port You can override the default port the daemon will listen on by
113 specifying this value (defaults to 873). This is ignored if the
114 daemon is being run by inetd, and is superseded by the --port
115 command-line option.
116
117 address
118 You can override the default IP address the daemon will listen
119 on by specifying this value. This is ignored if the daemon is
120 being run by inetd, and is superseded by the --address com‐
121 mand-line option.
122
123 socket options
124 This parameter can provide endless fun for people who like to
125 tune their systems to the utmost degree. You can set all sorts
126 of socket options which may make transfers faster (or slower!).
127 Read the man page for the setsockopt() system call for details
128 on some of the options you may be able to set. By default no
129 special socket options are set. These settings can also be
130 specified via the --sockopts command-line option.
131
132 listen backlog
133 You can override the default backlog value when the daemon lis‐
134 tens for connections. It defaults to 5.
135
137 After the global parameters you should define a number of modules, each
138 module exports a directory tree as a symbolic name. Modules are
139 exported by specifying a module name in square brackets [module] fol‐
140 lowed by the parameters for that module. The module name cannot con‐
141 tain a slash or a closing square bracket. If the name contains white‐
142 space, each internal sequence of whitespace will be changed into a sin‐
143 gle space, while leading or trailing whitespace will be discarded.
144 Also, the name cannot be "global" as that exact name indicates that
145 global parameters follow (see above).
146
147 As with GLOBAL PARAMETERS, you may use references to environment vari‐
148 ables in the values of parameters. See the GLOBAL PARAMETERS section
149 for more details.
150
151 comment
152 This parameter specifies a description string that is displayed
153 next to the module name when clients obtain a list of available
154 modules. The default is no comment.
155
156 path This parameter specifies the directory in the daemon’s filesys‐
157 tem to make available in this module. You must specify this
158 parameter for each module in rsyncd.conf.
159
160 You may base the path’s value off of an environment variable by
161 surrounding the variable name with percent signs. You can even
162 reference a variable that is set by rsync when the user con‐
163 nects. For example, this would use the authorizing user’s name
164 in the path:
165
166 path = /home/%RSYNC_USER_NAME%
167
168
169 It is fine if the path includes internal spaces -- they will be
170 retained verbatim (which means that you shouldn’t try to escape
171 them). If your final directory has a trailing space (and this
172 is somehow not something you wish to fix), append a trailing
173 slash to the path to avoid losing the trailing whitespace.
174
175 use chroot
176 If "use chroot" is true, the rsync daemon will chroot to the
177 "path" before starting the file transfer with the client. This
178 has the advantage of extra protection against possible implemen‐
179 tation security holes, but it has the disadvantages of requiring
180 super-user privileges, of not being able to follow symbolic
181 links that are either absolute or outside of the new root path,
182 and of complicating the preservation of users and groups by name
183 (see below).
184
185 As an additional safety feature, you can specify a dot-dir in
186 the module’s "path" to indicate the point where the chroot
187 should occur. This allows rsync to run in a chroot with a
188 non-"/" path for the top of the transfer hierarchy. Doing this
189 guards against unintended library loading (since those absolute
190 paths will not be inside the transfer hierarchy unless you have
191 used an unwise pathname), and lets you setup libraries for the
192 chroot that are outside of the transfer. For example, specify‐
193 ing "/var/rsync/./module1" will chroot to the "/var/rsync"
194 directory and set the inside-chroot path to "/module1". If you
195 had omitted the dot-dir, the chroot would have used the whole
196 path, and the inside-chroot path would have been "/".
197
198 When both "use chroot" and "daemon chroot" are false, OR the
199 inside-chroot path of "use chroot" is not "/", rsync will: (1)
200 munge symlinks by default for security reasons (see "munge sym‐
201 links" for a way to turn this off, but only if you trust your
202 users), (2) substitute leading slashes in absolute paths with
203 the module’s path (so that options such as --backup-dir, --com‐
204 pare-dest, etc. interpret an absolute path as rooted in the mod‐
205 ule’s "path" dir), and (3) trim ".." path elements from args if
206 rsync believes they would escape the module hierarchy. The
207 default for "use chroot" is true, and is the safer choice (espe‐
208 cially if the module is not read-only).
209
210 When this parameter is enabled, the "numeric-ids" option will
211 also default to being enabled (disabling name lookups). See
212 below for what a chroot needs in order for name lookups to suc‐
213 ceed.
214
215 If you copy library resources into the module’s chroot area, you
216 should protect them through your OS’s normal user/group or ACL
217 settings (to prevent the rsync module’s user from being able to
218 change them), and then hide them from the user’s view via
219 "exclude" (see how in the discussion of that parameter). At
220 that point it will be safe to enable the mapping of users and
221 groups by name using the "numeric ids" daemon parameter (see
222 below).
223
224 Note also that you are free to setup custom user/group informa‐
225 tion in the chroot area that is different from your normal sys‐
226 tem. For example, you could abbreviate the list of users and
227 groups.
228
229 daemon chroot
230 This parameter specifies a path to which the daemon will chroot
231 before beginning communication with clients. Module paths (and
232 any "use chroot" settings) will then be related to this one.
233 This lets you choose if you want the whole daemon to be chrooted
234 (with this setting), just the transfers to be chrooted (with
235 "use chroot"), or both. Keep in mind that the "daemon chroot"
236 area may need various OS/lib/etc files installed to allow the
237 daemon to function. By default the daemon runs without any
238 chrooting.
239
240 numeric ids
241 Enabling this parameter disables the mapping of users and groups
242 by name for the current daemon module. This prevents the daemon
243 from trying to load any user/group-related files or libraries.
244 This enabling makes the transfer behave as if the client had
245 passed the --numeric-ids command-line option. By default, this
246 parameter is enabled for chroot modules and disabled for
247 non-chroot modules. Also keep in mind that uid/gid preservation
248 requires the module to be running as root (see "uid") or for
249 "fake super" to be configured.
250
251 A chroot-enabled module should not have this parameter enabled
252 unless you’ve taken steps to ensure that the module has the nec‐
253 essary resources it needs to translate names, and that it is not
254 possible for a user to change those resources. That includes
255 being the code being able to call functions like getpwuid() ,
256 getgrgid() , getpwname() , and getgrnam() . You should test
257 what libraries and config files are required for your OS and get
258 those setup before starting to test name mapping in rsync.
259
260 munge symlinks
261 This parameter tells rsync to modify all symlinks in the same
262 way as the (non-daemon-affecting) --munge-links command-line
263 option (using a method described below). This should help pro‐
264 tect your files from user trickery when your daemon module is
265 writable. The default is disabled when "use chroot" is on with
266 an inside-chroot path of "/", OR if "daemon chroot" is on, oth‐
267 erwise it is enabled.
268
269 If you disable this parameter on a daemon that is not read-only,
270 there are tricks that a user can play with uploaded symlinks to
271 access daemon-excluded items (if your module has any), and, if
272 "use chroot" is off, rsync can even be tricked into showing or
273 changing data that is outside the module’s path (as access-per‐
274 missions allow).
275
276 The way rsync disables the use of symlinks is to prefix each one
277 with the string "/rsyncd-munged/". This prevents the links from
278 being used as long as that directory does not exist. When this
279 parameter is enabled, rsync will refuse to run if that path is a
280 directory or a symlink to a directory. When using the "munge
281 symlinks" parameter in a chroot area that has an inside-chroot
282 path of "/", you should add "/rsyncd-munged/" to the exclude
283 setting for the module so that a user can’t try to create it.
284
285 Note: rsync makes no attempt to verify that any pre-existing
286 symlinks in the module’s hierarchy are as safe as you want them
287 to be (unless, of course, it just copied in the whole hierar‐
288 chy). If you setup an rsync daemon on a new area or locally add
289 symlinks, you can manually protect your symlinks from being
290 abused by prefixing "/rsyncd-munged/" to the start of every sym‐
291 link’s value. There is a perl script in the support directory
292 of the source code named "munge-symlinks" that can be used to
293 add or remove this prefix from your symlinks.
294
295 When this parameter is disabled on a writable module and "use
296 chroot" is off (or the inside-chroot path is not "/"), incoming
297 symlinks will be modified to drop a leading slash and to remove
298 ".." path elements that rsync believes will allow a symlink to
299 escape the module’s hierarchy. There are tricky ways to work
300 around this, though, so you had better trust your users if you
301 choose this combination of parameters.
302
303 charset
304 This specifies the name of the character set in which the mod‐
305 ule’s filenames are stored. If the client uses an --iconv
306 option, the daemon will use the value of the "charset" parameter
307 regardless of the character set the client actually passed.
308 This allows the daemon to support charset conversion in a chroot
309 module without extra files in the chroot area, and also ensures
310 that name-translation is done in a consistent manner. If the
311 "charset" parameter is not set, the --iconv option is refused,
312 just as if "iconv" had been specified via "refuse options".
313
314 If you wish to force users to always use --iconv for a particu‐
315 lar module, add "no-iconv" to the "refuse options" parameter.
316 Keep in mind that this will restrict access to your module to
317 very new rsync clients.
318
319 max connections
320 This parameter allows you to specify the maximum number of
321 simultaneous connections you will allow. Any clients connecting
322 when the maximum has been reached will receive a message telling
323 them to try later. The default is 0, which means no limit. A
324 negative value disables the module. See also the "lock file"
325 parameter.
326
327 log file
328 When the "log file" parameter is set to a non-empty string, the
329 rsync daemon will log messages to the indicated file rather than
330 using syslog. This is particularly useful on systems (such as
331 AIX) where syslog() doesn’t work for chrooted programs. The
332 file is opened before chroot() is called, allowing it to be
333 placed outside the transfer. If this value is set on a per-mod‐
334 ule basis instead of globally, the global log will still contain
335 any authorization failures or config-file error messages.
336
337 If the daemon fails to open the specified file, it will fall
338 back to using syslog and output an error about the failure.
339 (Note that the failure to open the specified log file used to be
340 a fatal error.)
341
342 This setting can be overridden by using the --log-file=FILE or
343 --dparam=logfile=FILE command-line options. The former over‐
344 rides all the log-file parameters of the daemon and all module
345 settings. The latter sets the daemon’s log file and the default
346 for all the modules, which still allows modules to override the
347 default setting.
348
349 syslog facility
350 This parameter allows you to specify the syslog facility name to
351 use when logging messages from the rsync daemon. You may use any
352 standard syslog facility name which is defined on your system.
353 Common names are auth, authpriv, cron, daemon, ftp, kern, lpr,
354 mail, news, security, syslog, user, uucp, local0, local1,
355 local2, local3, local4, local5, local6 and local7. The default
356 is daemon. This setting has no effect if the "log file" setting
357 is a non-empty string (either set in the per-modules settings,
358 or inherited from the global settings).
359
360 syslog tag
361 This parameter allows you to specify the syslog tag to use when
362 logging messages from the rsync daemon. The default is "rsyncd".
363 This setting has no effect if the "log file" setting is a
364 non-empty string (either set in the per-modules settings, or
365 inherited from the global settings).
366
367 For example, if you wanted each authenticated user’s name to be
368 included in the syslog tag, you could do something like this:
369
370 syslog tag = rsyncd.%RSYNC_USER_NAME%
371
372
373 max verbosity
374 This parameter allows you to control the maximum amount of ver‐
375 bose information that you’ll allow the daemon to generate (since
376 the information goes into the log file). The default is 1, which
377 allows the client to request one level of verbosity.
378
379 This also affects the user’s ability to request higher levels of
380 --info and --debug logging. If the max value is 2, then no info
381 and/or debug value that is higher than what would be set by -vv
382 will be honored by the daemon in its logging. To see how high
383 of a verbosity level you need to accept for a particular
384 info/debug level, refer to "rsync --info=help" and "rsync
385 --debug=help". For instance, it takes max-verbosity 4 to be
386 able to output debug TIME2 and FLIST3.
387
388 lock file
389 This parameter specifies the file to use to support the "max
390 connections" parameter. The rsync daemon uses record locking on
391 this file to ensure that the max connections limit is not
392 exceeded for the modules sharing the lock file. The default is
393 /var/run/rsyncd.lock.
394
395 read only
396 This parameter determines whether clients will be able to upload
397 files or not. If "read only" is true then any attempted uploads
398 will fail. If "read only" is false then uploads will be possible
399 if file permissions on the daemon side allow them. The default
400 is for all modules to be read only.
401
402 Note that "auth users" can override this setting on a per-user
403 basis.
404
405 write only
406 This parameter determines whether clients will be able to down‐
407 load files or not. If "write only" is true then any attempted
408 downloads will fail. If "write only" is false then downloads
409 will be possible if file permissions on the daemon side allow
410 them. The default is for this parameter to be disabled.
411
412 Helpful hint: you probably want to specify "refuse options =
413 delete" for a write-only module.
414
415 list This parameter determines whether this module is listed when the
416 client asks for a listing of available modules. In addition, if
417 this is false, the daemon will pretend the module does not exist
418 when a client denied by "hosts allow" or "hosts deny" attempts
419 to access it. Realize that if "reverse lookup" is disabled
420 globally but enabled for the module, the resulting reverse
421 lookup to a potentially client-controlled DNS server may still
422 reveal to the client that it hit an existing module. The
423 default is for modules to be listable.
424
425 uid This parameter specifies the user name or user ID that file
426 transfers to and from that module should take place as when the
427 daemon was run as root. In combination with the "gid" parameter
428 this determines what file permissions are available. The default
429 when run by a super-user is to switch to the system’s "nobody"
430 user. The default for a non-super-user is to not try to change
431 the user. See also the "gid" parameter.
432
433 The RSYNC_USER_NAME environment variable may be used to request
434 that rsync run as the authorizing user. For example, if you
435 want a rsync to run as the same user that was received for the
436 rsync authentication, this setup is useful:
437
438 uid = %RSYNC_USER_NAME%
439 gid = *
440
441
442 gid This parameter specifies one or more group names/IDs that will
443 be used when accessing the module. The first one will be the
444 default group, and any extra ones be set as supplemental groups.
445 You may also specify a "*" as the first gid in the list, which
446 will be replaced by all the normal groups for the transfer’s
447 user (see "uid"). The default when run by a super-user is to
448 switch to your OS’s "nobody" (or perhaps "nogroup") group with
449 no other supplementary groups. The default for a non-super-user
450 is to not change any group attributes (and indeed, your OS may
451 not allow a non-super-user to try to change their group set‐
452 tings).
453
454 daemon uid
455 This parameter specifies a uid under which the daemon will run.
456 The daemon usually runs as user root, and when this is left
457 unset the user is left unchanged. See also the "uid" parameter.
458
459 daemon gid
460 This parameter specifies a gid under which the daemon will run.
461 The daemon usually runs as group root, and when this is left
462 unset, the group is left unchanged. See also the "gid" parame‐
463 ter.
464
465 fake super
466 Setting "fake super = yes" for a module causes the daemon side
467 to behave as if the --fake-super command-line option had been
468 specified. This allows the full attributes of a file to be
469 stored without having to have the daemon actually running as
470 root.
471
472 filter The daemon has its own filter chain that determines what files
473 it will let the client access. This chain is not sent to the
474 client and is independent of any filters the client may have
475 specified. Files excluded by the daemon filter chain (dae‐
476 mon-excluded files) are treated as non-existent if the client
477 tries to pull them, are skipped with an error message if the
478 client tries to push them (triggering exit code 23), and are
479 never deleted from the module. You can use daemon filters to
480 prevent clients from downloading or tampering with private
481 administrative files, such as files you may add to support
482 uid/gid name translations.
483
484 The daemon filter chain is built from the "filter", "include
485 from", "include", "exclude from", and "exclude" parameters, in
486 that order of priority. Anchored patterns are anchored at the
487 root of the module. To prevent access to an entire subtree, for
488 example, "/secret", you must exclude everything in the subtree;
489 the easiest way to do this is with a triple-star pattern like
490 "/secret/***".
491
492 The "filter" parameter takes a space-separated list of daemon
493 filter rules, though it is smart enough to know not to split a
494 token at an internal space in a rule (e.g. "- /foo - /bar" is
495 parsed as two rules). You may specify one or more merge-file
496 rules using the normal syntax. Only one "filter" parameter can
497 apply to a given module in the config file, so put all the rules
498 you want in a single parameter. Note that per-directory
499 merge-file rules do not provide as much protection as global
500 rules, but they can be used to make --delete work better during
501 a client download operation if the per-dir merge files are
502 included in the transfer and the client requests that they be
503 used.
504
505 exclude
506 This parameter takes a space-separated list of daemon exclude
507 patterns. As with the client --exclude option, patterns can be
508 qualified with "- " or "+ " to explicitly indicate
509 exclude/include. Only one "exclude" parameter can apply to a
510 given module. See the "filter" parameter for a description of
511 how excluded files affect the daemon.
512
513 include
514 Use an "include" to override the effects of the "exclude" param‐
515 eter. Only one "include" parameter can apply to a given module.
516 See the "filter" parameter for a description of how excluded
517 files affect the daemon.
518
519 exclude from
520 This parameter specifies the name of a file on the daemon that
521 contains daemon exclude patterns, one per line. Only one
522 "exclude from" parameter can apply to a given module; if you
523 have multiple exclude-from files, you can specify them as a
524 merge file in the "filter" parameter. See the "filter" parame‐
525 ter for a description of how excluded files affect the daemon.
526
527 include from
528 Analogue of "exclude from" for a file of daemon include pat‐
529 terns. Only one "include from" parameter can apply to a given
530 module. See the "filter" parameter for a description of how
531 excluded files affect the daemon.
532
533 incoming chmod
534 This parameter allows you to specify a set of comma-separated
535 chmod strings that will affect the permissions of all incoming
536 files (files that are being received by the daemon). These
537 changes happen after all other permission calculations, and this
538 will even override destination-default and/or existing permis‐
539 sions when the client does not specify --perms. See the
540 description of the --chmod rsync option and the chmod(1) manpage
541 for information on the format of this string.
542
543 outgoing chmod
544 This parameter allows you to specify a set of comma-separated
545 chmod strings that will affect the permissions of all outgoing
546 files (files that are being sent out from the daemon). These
547 changes happen first, making the sent permissions appear to be
548 different than those stored in the filesystem itself. For
549 instance, you could disable group write permissions on the
550 server while having it appear to be on to the clients. See the
551 description of the --chmod rsync option and the chmod(1) manpage
552 for information on the format of this string.
553
554 auth users
555 This parameter specifies a comma and/or space-separated list of
556 authorization rules. In its simplest form, you list the user‐
557 names that will be allowed to connect to this module. The user‐
558 names do not need to exist on the local system. The rules may
559 contain shell wildcard characters that will be matched against
560 the username provided by the client for authentication. If "auth
561 users" is set then the client will be challenged to supply a
562 username and password to connect to the module. A challenge
563 response authentication protocol is used for this exchange. The
564 plain text usernames and passwords are stored in the file speci‐
565 fied by the "secrets file" parameter. The default is for all
566 users to be able to connect without a password (this is called
567 "anonymous rsync").
568
569 In addition to username matching, you can specify groupname
570 matching via a ’@’ prefix. When using groupname matching, the
571 authenticating username must be a real user on the system, or it
572 will be assumed to be a member of no groups. For example, spec‐
573 ifying "@rsync" will match the authenticating user if the named
574 user is a member of the rsync group.
575
576 Finally, options may be specified after a colon (:). The
577 options allow you to "deny" a user or a group, set the access to
578 "ro" (read-only), or set the access to "rw" (read/write). Set‐
579 ting an auth-rule-specific ro/rw setting overrides the module’s
580 "read only" setting.
581
582 Be sure to put the rules in the order you want them to be
583 matched, because the checking stops at the first matching user
584 or group, and that is the only auth that is checked. For exam‐
585 ple:
586
587 auth users = joe:deny @guest:deny admin:rw @rsync:ro susan joe sam
588
589
590 In the above rule, user joe will be denied access no matter
591 what. Any user that is in the group "guest" is also denied
592 access. The user "admin" gets access in read/write mode, but
593 only if the admin user is not in group "guest" (because the
594 admin user-matching rule would never be reached if the user is
595 in group "guest"). Any other user who is in group "rsync" will
596 get read-only access. Finally, users susan, joe, and sam get
597 the ro/rw setting of the module, but only if the user didn’t
598 match an earlier group-matching rule.
599
600 If you need to specify a user or group name with a space in it,
601 start your list with a comma to indicate that the list should
602 only be split on commas (though leading and trailing whitespace
603 will also be removed, and empty entries are just ignored). For
604 example:
605
606 auth users = , joe:deny, @Some Group:deny, admin:rw, @RO Group:ro
607
608
609 See the description of the secrets file for how you can have
610 per-user passwords as well as per-group passwords. It also
611 explains how a user can authenticate using their user password
612 or (when applicable) a group password, depending on what rule is
613 being authenticated.
614
615 See also the section entitled "USING RSYNC-DAEMON FEATURES VIA A
616 REMOTE SHELL CONNECTION" in rsync(1) for information on how han‐
617 dle an rsyncd.conf-level username that differs from the
618 remote-shell-level username when using a remote shell to connect
619 to an rsync daemon.
620
621 secrets file
622 This parameter specifies the name of a file that contains the
623 username:password and/or @groupname:password pairs used for
624 authenticating this module. This file is only consulted if the
625 "auth users" parameter is specified. The file is line-based and
626 contains one name:password pair per line. Any line has a hash
627 (#) as the very first character on the line is considered a com‐
628 ment and is skipped. The passwords can contain any characters
629 but be warned that many operating systems limit the length of
630 passwords that can be typed at the client end, so you may find
631 that passwords longer than 8 characters don’t work.
632
633 The use of group-specific lines are only relevant when the mod‐
634 ule is being authorized using a matching "@groupname" rule.
635 When that happens, the user can be authorized via either their
636 "username:password" line or the "@groupname:password" line for
637 the group that triggered the authentication.
638
639 It is up to you what kind of password entries you want to
640 include, either users, groups, or both. The use of group rules
641 in "auth users" does not require that you specify a group pass‐
642 word if you do not want to use shared passwords.
643
644 There is no default for the "secrets file" parameter, you must
645 choose a name (such as /etc/rsyncd.secrets). The file must nor‐
646 mally not be readable by "other"; see "strict modes". If the
647 file is not found or is rejected, no logins for a "user auth"
648 module will be possible.
649
650 strict modes
651 This parameter determines whether or not the permissions on the
652 secrets file will be checked. If "strict modes" is true, then
653 the secrets file must not be readable by any user ID other than
654 the one that the rsync daemon is running under. If "strict
655 modes" is false, the check is not performed. The default is
656 true. This parameter was added to accommodate rsync running on
657 the Windows operating system.
658
659 hosts allow
660 This parameter allows you to specify a list of comma- and/or
661 whitespace-separated patterns that are matched against a con‐
662 necting client’s hostname and IP address. If none of the pat‐
663 terns match, then the connection is rejected.
664
665 Each pattern can be in one of five forms:
666
667 o a dotted decimal IPv4 address of the form a.b.c.d, or an
668 IPv6 address of the form a:b:c::d:e:f. In this case the
669 incoming machine’s IP address must match exactly.
670
671 o an address/mask in the form ipaddr/n where ipaddr is the
672 IP address and n is the number of one bits in the net‐
673 mask. All IP addresses which match the masked IP address
674 will be allowed in.
675
676 o an address/mask in the form ipaddr/maskaddr where ipaddr
677 is the IP address and maskaddr is the netmask in dotted
678 decimal notation for IPv4, or similar for IPv6, e.g.
679 ffff:ffff:ffff:ffff:: instead of /64. All IP addresses
680 which match the masked IP address will be allowed in.
681
682 o a hostname pattern using wildcards. If the hostname of
683 the connecting IP (as determined by a reverse lookup)
684 matches the wildcarded name (using the same rules as nor‐
685 mal unix filename matching), the client is allowed in.
686 This only works if "reverse lookup" is enabled (the
687 default).
688
689 o a hostname. A plain hostname is matched against the
690 reverse DNS of the connecting IP (if "reverse lookup" is
691 enabled), and/or the IP of the given hostname is matched
692 against the connecting IP (if "forward lookup" is
693 enabled, as it is by default). Any match will be allowed
694 in.
695
696
697 Note IPv6 link-local addresses can have a scope in the address
698 specification:
699
700 fe80::1%link1
701 fe80::%link1/64
702 fe80::%link1/ffff:ffff:ffff:ffff::
703
704
705 You can also combine "hosts allow" with a separate "hosts deny"
706 parameter. If both parameters are specified then the "hosts
707 allow" parameter is checked first and a match results in the
708 client being able to connect. The "hosts deny" parameter is then
709 checked and a match means that the host is rejected. If the host
710 does not match either the "hosts allow" or the "hosts deny" pat‐
711 terns then it is allowed to connect.
712
713 The default is no "hosts allow" parameter, which means all hosts
714 can connect.
715
716 hosts deny
717 This parameter allows you to specify a list of comma- and/or
718 whitespace-separated patterns that are matched against a con‐
719 necting clients hostname and IP address. If the pattern matches
720 then the connection is rejected. See the "hosts allow" parameter
721 for more information.
722
723 The default is no "hosts deny" parameter, which means all hosts
724 can connect.
725
726 reverse lookup
727 Controls whether the daemon performs a reverse lookup on the
728 client’s IP address to determine its hostname, which is used for
729 "hosts allow"/"hosts deny" checks and the "%h" log escape. This
730 is enabled by default, but you may wish to disable it to save
731 time if you know the lookup will not return a useful result, in
732 which case the daemon will use the name "UNDETERMINED" instead.
733
734 If this parameter is enabled globally (even by default), rsync
735 performs the lookup as soon as a client connects, so disabling
736 it for a module will not avoid the lookup. Thus, you probably
737 want to disable it globally and then enable it for modules that
738 need the information.
739
740 forward lookup
741 Controls whether the daemon performs a forward lookup on any
742 hostname specified in an hosts allow/deny setting. By default
743 this is enabled, allowing the use of an explicit hostname that
744 would not be returned by reverse DNS of the connecting IP.
745
746 ignore errors
747 This parameter tells rsyncd to ignore I/O errors on the daemon
748 when deciding whether to run the delete phase of the transfer.
749 Normally rsync skips the --delete step if any I/O errors have
750 occurred in order to prevent disastrous deletion due to a tempo‐
751 rary resource shortage or other I/O error. In some cases this
752 test is counter productive so you can use this parameter to turn
753 off this behavior.
754
755 ignore nonreadable
756 This tells the rsync daemon to completely ignore files that are
757 not readable by the user. This is useful for public archives
758 that may have some non-readable files among the directories, and
759 the sysadmin doesn’t want those files to be seen at all.
760
761 transfer logging
762 This parameter enables per-file logging of downloads and uploads
763 in a format somewhat similar to that used by ftp daemons. The
764 daemon always logs the transfer at the end, so if a transfer is
765 aborted, no mention will be made in the log file.
766
767 If you want to customize the log lines, see the "log format"
768 parameter.
769
770 log format
771 This parameter allows you to specify the format used for logging
772 file transfers when transfer logging is enabled. The format is
773 a text string containing embedded single-character escape
774 sequences prefixed with a percent (%) character. An optional
775 numeric field width may also be specified between the percent
776 and the escape letter (e.g. "%-50n %8l %07p"). In addition, one
777 or more apostrophes may be specified prior to a numerical escape
778 to indicate that the numerical value should be made more
779 human-readable. The 3 supported levels are the same as for the
780 --human-readable command-line option, though the default is for
781 human-readability to be off. Each added apostrophe increases
782 the level (e.g. "%''l %'b %f").
783
784 The default log format is "%o %h [%a] %m (%u) %f %l", and a "%t
785 [%p] " is always prefixed when using the "log file" parameter.
786 (A perl script that will summarize this default log format is
787 included in the rsync source code distribution in the "support"
788 subdirectory: rsyncstats.)
789
790 The single-character escapes that are understood are as follows:
791
792 o %a the remote IP address (only available for a daemon)
793
794 o %b the number of bytes actually transferred
795
796 o %B the permission bits of the file (e.g. rwxrwxrwt)
797
798 o %c the total size of the block checksums received for the
799 basis file (only when sending)
800
801 o %C the full-file checksum if it is known for the file.
802 For older rsync protocols/versions, the checksum was
803 salted, and is thus not a useful value (and is not dis‐
804 played when that is the case). For the checksum to output
805 for a file, either the --checksum option must be
806 in-effect or the file must have been transferred without
807 a salted checksum being used. See the --checksum-choice
808 option for a way to choose the algorithm.
809
810 o %f the filename (long form on sender; no trailing "/")
811
812 o %G the gid of the file (decimal) or "DEFAULT"
813
814 o %h the remote host name (only available for a daemon)
815
816 o %i an itemized list of what is being updated
817
818 o %l the length of the file in bytes
819
820 o %L the string " -> SYMLINK", " => HARDLINK", or "" (where
821 SYMLINK or HARDLINK is a filename)
822
823 o %m the module name
824
825 o %M the last-modified time of the file
826
827 o %n the filename (short form; trailing "/" on dir)
828
829 o %o the operation, which is "send", "recv", or "del." (the
830 latter includes the trailing period)
831
832 o %p the process ID of this rsync session
833
834 o %P the module path
835
836 o %t the current date time
837
838 o %u the authenticated username or an empty string
839
840 o %U the uid of the file (decimal)
841
842
843 For a list of what the characters mean that are output by "%i",
844 see the --itemize-changes option in the rsync manpage.
845
846 Note that some of the logged output changes when talking with
847 older rsync versions. For instance, deleted files were only
848 output as verbose messages prior to rsync 2.6.4.
849
850 timeout
851 This parameter allows you to override the clients choice for I/O
852 timeout for this module. Using this parameter you can ensure
853 that rsync won’t wait on a dead client forever. The timeout is
854 specified in seconds. A value of zero means no timeout and is
855 the default. A good choice for anonymous rsync daemons may be
856 600 (giving a 10 minute timeout).
857
858 refuse options
859 This parameter allows you to specify a space-separated list of
860 rsync command line options that will be refused by your rsync
861 daemon. You may specify the full option name, its one-letter
862 abbreviation, or a wild-card string that matches multiple
863 options. For example, this would refuse --checksum (-c) and all
864 the various delete options:
865
866 refuse options = c delete
867
868
869 The reason the above refuses all delete options is that the
870 options imply --delete, and implied options are refused just
871 like explicit options. As an additional safety feature, the
872 refusal of "delete" also refuses remove-source-files when the
873 daemon is the sender; if you want the latter without the former,
874 instead refuse "delete-*" -- that refuses all the delete modes
875 without affecting --remove-source-files.
876
877 When an option is refused, the daemon prints an error message
878 and exits. To prevent all compression when serving files, you
879 can use "dont compress = *" (see below) instead of "refuse
880 options = compress" to avoid returning an error to a client that
881 requests compression.
882
883 dont compress
884 This parameter allows you to select filenames based on wildcard
885 patterns that should not be compressed when pulling files from
886 the daemon (no analogous parameter exists to govern the pushing
887 of files to a daemon). Compression is expensive in terms of CPU
888 usage, so it is usually good to not try to compress files that
889 won’t compress well, such as already compressed files.
890
891 The "dont compress" parameter takes a space-separated list of
892 case-insensitive wildcard patterns. Any source filename matching
893 one of the patterns will not be compressed during transfer.
894
895 See the --skip-compress parameter in the rsync(1) manpage for
896 the list of file suffixes that are not compressed by default.
897 Specifying a value for the "dont compress" parameter changes the
898 default when the daemon is the sender.
899
900 pre-xfer exec, post-xfer exec
901 You may specify a command to be run before and/or after the
902 transfer. If the pre-xfer exec command fails, the transfer is
903 aborted before it begins. Any output from the script on stdout
904 (up to several KB) will be displayed to the user when aborting,
905 but is NOT displayed if the script returns success. Any output
906 from the script on stderr goes to the daemon’s stderr, which is
907 typically discarded (though see --no-detatch option for a way to
908 see the stderr output, which can assist with debugging).
909
910 The following environment variables will be set, though some are
911 specific to the pre-xfer or the post-xfer environment:
912
913 o RSYNC_MODULE_NAME: The name of the module being accessed.
914
915 o RSYNC_MODULE_PATH: The path configured for the module.
916
917 o RSYNC_HOST_ADDR: The accessing host’s IP address.
918
919 o RSYNC_HOST_NAME: The accessing host’s name.
920
921 o RSYNC_USER_NAME: The accessing user’s name (empty if no
922 user).
923
924 o RSYNC_PID: A unique number for this transfer.
925
926 o RSYNC_REQUEST: (pre-xfer only) The module/path info spec‐
927 ified by the user. Note that the user can specify multi‐
928 ple source files, so the request can be something like
929 "mod/path1 mod/path2", etc.
930
931 o RSYNC_ARG#: (pre-xfer only) The pre-request arguments are
932 set in these numbered values. RSYNC_ARG0 is always
933 "rsyncd", followed by the options that were used in
934 RSYNC_ARG1, and so on. There will be a value of "."
935 indicating that the options are done and the path args
936 are beginning -- these contain similar information to
937 RSYNC_REQUEST, but with values separated and the module
938 name stripped off.
939
940 o RSYNC_EXIT_STATUS: (post-xfer only) the server side’s
941 exit value. This will be 0 for a successful run, a posi‐
942 tive value for an error that the server generated, or a
943 -1 if rsync failed to exit properly. Note that an error
944 that occurs on the client side does not currently get
945 sent to the server side, so this is not the final exit
946 status for the whole transfer.
947
948 o RSYNC_RAW_STATUS: (post-xfer only) the raw exit value
949 from waitpid() .
950
951
952 Even though the commands can be associated with a particular
953 module, they are run using the permissions of the user that
954 started the daemon (not the module’s uid/gid setting) without
955 any chroot restrictions.
956
958 There are currently two config directives available that allow a config
959 file to incorporate the contents of other files: &include and &merge.
960 Both allow a reference to either a file or a directory. They differ in
961 how segregated the file’s contents are considered to be.
962
963 The &include directive treats each file as more distinct, with each one
964 inheriting the defaults of the parent file, starting the parameter
965 parsing as globals/defaults, and leaving the defaults unchanged for the
966 parsing of the rest of the parent file.
967
968 The &merge directive, on the other hand, treats the file’s contents as
969 if it were simply inserted in place of the directive, and thus it can
970 set parameters in a module started in another file, can affect the
971 defaults for other files, etc.
972
973 When an &include or &merge directive refers to a directory, it will
974 read in all the *.conf or *.inc files (respectively) that are contained
975 inside that directory (without any recursive scanning), with the files
976 sorted into alpha order. So, if you have a directory named "rsyncd.d"
977 with the files "foo.conf", "bar.conf", and "baz.conf" inside it, this
978 directive:
979
980 &include /path/rsyncd.d
981
982
983 would be the same as this set of directives:
984
985 &include /path/rsyncd.d/bar.conf
986 &include /path/rsyncd.d/baz.conf
987 &include /path/rsyncd.d/foo.conf
988
989
990 except that it adjusts as files are added and removed from the direc‐
991 tory.
992
993 The advantage of the &include directive is that you can define one or
994 more modules in a separate file without worrying about unintended
995 side-effects between the self-contained module files.
996
997 The advantage of the &merge directive is that you can load config snip‐
998 pets that can be included into multiple module definitions, and you can
999 also set global values that will affect connections (such as motd
1000 file), or globals that will affect other include files.
1001
1002 For example, this is a useful /etc/rsyncd.conf file:
1003
1004 port = 873
1005 log file = /var/log/rsync.log
1006 pid file = /var/lock/rsync.lock
1007
1008 &merge /etc/rsyncd.d
1009 &include /etc/rsyncd.d
1010
1011
1012 This would merge any /etc/rsyncd.d/*.inc files (for global values that
1013 should stay in effect), and then include any /etc/rsyncd.d/*.conf files
1014 (defining modules without any global-value cross-talk).
1015
1017 The authentication protocol used in rsync is a 128 bit MD4 based chal‐
1018 lenge response system. This is fairly weak protection, though (with at
1019 least one brute-force hash-finding algorithm publicly available), so if
1020 you want really top-quality security, then I recommend that you run
1021 rsync over ssh. (Yes, a future version of rsync will switch over to a
1022 stronger hashing method.)
1023
1024 Also note that the rsync daemon protocol does not currently provide any
1025 encryption of the data that is transferred over the connection. Only
1026 authentication is provided. Use ssh as the transport if you want
1027 encryption.
1028
1029 Future versions of rsync may support SSL for better authentication and
1030 encryption, but that is still being investigated.
1031
1033 A simple rsyncd.conf file that allow anonymous rsync to a ftp area at
1034 /home/ftp would be:
1035
1036 [ftp]
1037 path = /home/ftp
1038 comment = ftp export area
1039
1040
1041
1042 A more sophisticated example would be:
1043
1044 uid = nobody
1045 gid = nobody
1046 use chroot = yes
1047 max connections = 4
1048 syslog facility = local5
1049 pid file = /var/run/rsyncd.pid
1050
1051 [ftp]
1052 path = /var/ftp/./pub
1053 comment = whole ftp area (approx 6.1 GB)
1054
1055 [sambaftp]
1056 path = /var/ftp/./pub/samba
1057 comment = Samba ftp area (approx 300 MB)
1058
1059 [rsyncftp]
1060 path = /var/ftp/./pub/rsync
1061 comment = rsync ftp area (approx 6 MB)
1062
1063 [sambawww]
1064 path = /public_html/samba
1065 comment = Samba WWW pages (approx 240 MB)
1066
1067 [cvs]
1068 path = /data/cvs
1069 comment = CVS repository (requires authentication)
1070 auth users = tridge, susan
1071 secrets file = /etc/rsyncd.secrets
1072
1073
1074
1075 The /etc/rsyncd.secrets file would look something like this:
1076
1077 tridge:mypass
1078 susan:herpass
1079
1080
1082 /etc/rsyncd.conf or rsyncd.conf
1083
1085 rsync(1)
1086
1089 Please report bugs! The rsync bug tracking system is online at
1090 http://rsync.samba.org/
1091
1093 This man page is current for version 3.1.3 of rsync.
1094
1096 rsync is distributed under the GNU General Public License. See the
1097 file COPYING for details.
1098
1099 The primary ftp site for rsync is ftp://rsync.samba.org/pub/rsync.
1100
1101 A WEB site is available at http://rsync.samba.org/
1102
1103 We would be delighted to hear from you if you like this program.
1104
1105 This program uses the zlib compression library written by Jean-loup
1106 Gailly and Mark Adler.
1107
1109 Thanks to Warren Stanley for his original idea and patch for the rsync
1110 daemon. Thanks to Karsten Thygesen for his many suggestions and docu‐
1111 mentation!
1112
1114 rsync was written by Andrew Tridgell and Paul Mackerras. Many people
1115 have later contributed to it.
1116
1117 Mailing lists for support and development are available at
1118 http://lists.samba.org
1119
1120
1121
1122 28 Jan 2018 rsyncd.conf(5)