📄 rsyncd.conf.5
字号:
.TH "rsyncd.conf" "5" "28 Dec 2008" "" "".SH "NAME"rsyncd.conf \(em configuration file for rsync in daemon mode.SH "SYNOPSIS".PP rsyncd.conf.PP .SH "DESCRIPTION".PP The rsyncd.conf file is the runtime configuration file for rsync whenrun as an rsync daemon..PP The rsyncd.conf file controls authentication, access, logging andavailable modules..PP .SH "FILE FORMAT".PP The file consists of modules and parameters. A module begins with thename of the module in square brackets and continues until the nextmodule begins. Modules contain parameters of the form \(lqname = value\(rq..PP The file is line-based \(em that is, each newline-terminated line representseither a comment, a module name or a parameter..PP Only the first equals sign in a parameter is significant. Whitespace beforeor after the first equals sign is discarded. Leading, trailing and internalwhitespace in module and parameter names is irrelevant. Leading andtrailing whitespace in a parameter value is discarded. Internal whitespacewithin a parameter value is retained verbatim..PP Any line beginning with a hash (#) is ignored, as are lines containingonly whitespace..PP Any line ending in a \e is \(lqcontinued\(rq on the next line in thecustomary UNIX fashion..PP The values following the equals sign in parameters are all either a string(no quotes needed) or a boolean, which may be given as yes/no, 0/1 ortrue/false. Case is not significant in boolean values, but is preservedin string values..PP .SH "LAUNCHING THE RSYNC DAEMON".PP The rsync daemon is launched by specifying the \fB\-\-daemon\fP option torsync..PP The daemon must run with root privileges if you wish to use chroot, tobind to a port numbered under 1024 (as is the default 873), or to setfile ownership. Otherwise, it must just have permission to read andwrite the appropriate data, log, and lock files..PP You can launch it either via inetd, as a stand-alone daemon, or froman rsync client via a remote shell. If run as a stand-alone daemon thenjust run the command \(lq\fBrsync \-\-daemon\fP\(rq from a suitable startup script..PP When run via inetd you should add a line like this to /etc/services:.PP .nf rsync 873/tcp.fi .PP and a single line something like this to /etc/inetd.conf:.PP .nf rsync stream tcp nowait root /usr/bin/rsync rsyncd \-\-daemon.fi .PP Replace \(lq/usr/bin/rsync\(rq with the path to where you have rsync installed onyour system. You will then need to send inetd a HUP signal to tell it toreread its config file..PP Note that you should \fBnot\fP send the rsync daemon a HUP signal to forceit to reread the \f(CWrsyncd.conf\fP file. The file is re-read on each clientconnection..PP .SH "GLOBAL PARAMETERS".PP The first parameters in the file (before a [module] header) are theglobal parameters..PP You may also include any module parameters in the global part of theconfig file in which case the supplied value will override thedefault for that parameter..PP .IP "\fBmotd file\fP"This parameter allows you to specify a\(lqmessage of the day\(rq to display to clients on each connect. Thisusually contains site information and any legal notices. The defaultis no motd file..IP .IP "\fBpid file\fP"This parameter tells the rsync daemon to writeits process ID to that file. If the file already exists, the rsyncdaemon will abort rather than overwrite the file..IP .IP "\fBport\fP"You can override the default port the daemon will listen onby specifying this value (defaults to 873). This is ignored if the daemonis being run by inetd, and is superseded by the \fB\-\-port\fP command-line option..IP .IP "\fBaddress\fP"You can override the default IP address the daemonwill listen on by specifying this value. This is ignored if the daemon isbeing run by inetd, and is superseded by the \fB\-\-address\fP command-line option..IP .IP "\fBsocket options\fP"This parameter can provide endless fun for peoplewho like to tune their systems to the utmost degree. You can set allsorts of socket options which may make transfers faster (orslower!). Read the man page for the \f(CWsetsockopt()\fPsystem call fordetails on some of the options you may be able to set. By default nospecial socket options are set. These settings can also be specifiedvia the \fB\-\-sockopts\fP command-line option..IP .SH "MODULE PARAMETERS".PP After the global parameters you should define a number of modules, eachmodule exports a directory tree as a symbolic name. Modules areexported by specifying a module name in square brackets [module]followed by the parameters for that module.The module name cannot contain a slash or a closing square bracket. If thename contains whitespace, each internal sequence of whitespace will bechanged into a single space, while leading or trailing whitespace will bediscarded..PP .IP "\fBcomment\fP"This parameter specifies a description stringthat is displayed next to the module name when clients obtain a listof available modules. The default is no comment..IP .IP "\fBpath\fP"This parameter specifies the directory in the daemon'sfilesystem to make available in this module. You must specify this parameterfor each module in \f(CWrsyncd.conf\fP..IP .IP "\fBuse chroot\fP"If \(lquse chroot\(rq is true, the rsync daemon will chrootto the \(lqpath\(rq before starting the file transfer with the client. This hasthe advantage of extra protection against possible implementation securityholes, but it has the disadvantages of requiring super-user privileges,of not being able to follow symbolic links that are either absolute or outsideof the new root path, and of complicating the preservation of users and groupsby name (see below)..IP As an additional safety feature, you can specify a dot-dir in the module's\(lqpath\(rq to indicate the point where the chroot should occur. This allows rsyncto run in a chroot with a non\-"/\(rq path for the top of the transfer hierarchy.Doing this guards against unintended library loading (since those absolutepaths will not be inside the transfer hierarchy unless you have used an unwisepathname), and lets you setup libraries for the chroot that are outside of thetransfer. For example, specifying \(lq/var/rsync/./module1\(rq will chroot to the\(lq/var/rsync\(rq directory and set the inside-chroot path to \(lq/module1\(rq. If youhad omitted the dot-dir, the chroot would have used the whole path, and theinside-chroot path would have been \(lq/\(rq..IP When \(lquse chroot\(rq is false or the inside-chroot path is not \(lq/\(rq, rsync will:(1) munge symlinks bydefault for security reasons (see \(lqmunge symlinks\(rq for a way to turn thisoff, but only if you trust your users), (2) substitute leading slashes inabsolute paths with the module's path (so that options such as\fB\-\-backup\-dir\fP, \fB\-\-compare\-dest\fP, etc. interpret an absolute path asrooted in the module's \(lqpath\(rq dir), and (3) trim \(lq..\(rq path elements fromargs if rsync believes they would escape the module hierarchy.The default for \(lquse chroot\(rq is true, and is the safer choice (especiallyif the module is not read-only)..IP When this parameter is enabled, rsync will not attempt to map users and groupsby name (by default), but instead copy IDs as though \fB\-\-numeric\-ids\fP hadbeen specified. In order to enable name-mapping, rsync needs to be able touse the standard library functions for looking up names and IDs (i.e.\f(CWgetpwuid()\fP, \f(CWgetgrgid()\fP, \f(CWgetpwname()\fP, and \f(CWgetgrnam()\fP).This means the rsyncprocess in the chroot hierarchy will need to have access to the resourcesused by these library functions (traditionally /etc/passwd and/etc/group, but perhaps additional dynamic libraries as well)..IP If you copy the necessary resources into the module's chroot area, youshould protect them through your OS's normal user/group or ACL settings (toprevent the rsync module's user from being able to change them), and thenhide them from the user's view via \(lqexclude\(rq (see how in the discussion ofthat parameter). At that point it will be safe to enable the mapping of usersand groups by name using the \(lqnumeric ids\(rq daemon parameter (see below)..IP Note also that you are free to setup custom user/group information in thechroot area that is different from your normal system. For example, youcould abbreviate the list of users and groups..IP .IP "\fBnumeric ids\fP"Enabling this parameter disables the mappingof users and groups by name for the current daemon module. This preventsthe daemon from trying to load any user/group-related files or libraries.This enabling makes the transfer behave as if the client had passedthe \fB\-\-numeric\-ids\fP command-line option. By default, this parameter isenabled for chroot modules and disabled for non-chroot modules..IP A chroot-enabled module should not have this parameter enabled unless you'vetaken steps to ensure that the module has the necessary resources it needsto translate names, and that it is not possible for a user to change thoseresources..IP .IP "\fBmunge symlinks\fP"This parameter tells rsync to modifyall incoming symlinks in a way that makes them unusable but recoverable(see below). This should help protect your files from user trickery whenyour daemon module is writable. The default is disabled when \(lquse chroot\(rqis on and the inside-chroot path is \(lq/\(rq, otherwise it is enabled..IP If you disable this parameter on a daemon that is not read-only, thereare tricks that a user can play with uploaded symlinks to accessdaemon-excluded items (if your module has any), and, if \(lquse chroot\(rqis off, rsync can even be tricked into showing or changing data thatis outside the module's path (as access-permissions allow)..IP The way rsync disables the use of symlinks is to prefix each one withthe string \(lq/rsyncd-munged/\(rq. This prevents the links from being usedas long as that directory does not exist. When this parameter is enabled,rsync will refuse to run if that path is a directory or a symlink toa directory. When using the \(lqmunge symlinks\(rq parameter in a chroot areathat has an inside-chroot path of \(lq/\(rq, you should add \(lq/rsyncd-munged/\(rqto the exclude setting for the module so thata user can't try to create it..IP Note: rsync makes no attempt to verify that any pre-existing symlinks inthe module's hierarchy are as safe as you want them to be (unless, ofcourse, it just copied in the whole hierarchy). If you setup an rsyncdaemon on a new area or locally add symlinks, you can manually protect yoursymlinks from being abused by prefixing \(lq/rsyncd-munged/\(rq to the start ofevery symlink's value. There is a perl script in the support directoryof the source code named \(lqmunge-symlinks\(rq that can be used to add or removethis prefix from your symlinks..IP When this parameter is disabled on a writable module and \(lquse chroot\(rq is off(or the inside-chroot path is not \(lq/\(rq),incoming symlinks will be modified to drop a leading slash and to remove \(lq..\(rqpath elements that rsync believes will allow a symlink to escape the module'shierarchy. There are tricky ways to work around this, though, so you hadbetter trust your users if you choose this combination of parameters..IP .IP "\fBcharset\fP"This specifies the name of the character set in which themodule's filenames are stored. If the client uses an \fB\-\-iconv\fP option,the daemon will use the value of the \(lqcharset\(rq parameter regardless of thecharacter set the client actually passed. This allows the daemon tosupport charset conversion in a chroot module without extra files in thechroot area, and also ensures that name-translation is done in a consistentmanner. If the \(lqcharset\(rq parameter is not set, the \fB\-\-iconv\fP option isrefused, just as if \(lqiconv\(rq had been specified via \(lqrefuse options\(rq..IP If you wish to force users to always use \fB\-\-iconv\fP for a particularmodule, add \(lqno-iconv\(rq to the \(lqrefuse options\(rq parameter. Keep in mindthat this will restrict access to your module to very new rsync clients..IP .IP "\fBmax connections\fP"This parameter allows you tospecify the maximum number of simultaneous connections you will allow.Any clients connecting when the maximum has been reached will receive amessage telling them to try later. The default is 0, which means no limit.A negative value disables the module.See also the \(lqlock file\(rq parameter..IP .IP "\fBlog file\fP"When the \(lqlog file\(rq parameter is set to a non-emptystring, the rsync daemon will log messages to the indicated file ratherthan using syslog. This is particularly useful on systems (such as AIX)where \f(CWsyslog()\fPdoesn't work for chrooted programs. The file isopened before \f(CWchroot()\fPis called, allowing it to be placed outside
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -