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