Pick a Free OS

Using Rsync


1. /etc/rsyncd.conf file configurations:

When you run Rsync with --daemon mode /etc/rsyncd.conf is the runtime configuration file through inetd daemon. This way rsync becomes an rsync server listening on TCP port 873. Connections from Rsync clients are accepted for either anonymous or authenticated Rsync sessions. The rsyncd.conf file controls authentication, access, logging and available modules.

File Format of rsyncd.conf:


The file consists of modules and parameters. A module begins with the name of the module in square brackets and continues until the next module begins. Modules contain parameters of the form 'name = value'. For more information about format you can read out the man pages of rysncd.conf

The contents of a /etc/rsyncd.conf file may be:


#### rsyncd.conf file ####

uid = username 

gid = usergid

pid file = /etc/rsyncd.pid 

syslog facility = daemon 

[modulename]  #Module name could be any name 

path = /path/to/yourdata 

comment = user related any info 

auth users = anonymous username 

hosts allow = x.x.x.x

secrets file =/etc/rsyncd.secrets 

max connection = 0 

use chroot = true 

timeout = 60 

#### End of configuration file ####

The file contains hundreds of options; we will only discuss only those, which are important and generally used. The file contains some global parameters like motd, syslog etc. Others are module related. In the above configuration, a square bracket represents the module for a particular dir, which is generally backed up. Comments are any user related info. The "auth users" gives the details of the users who can use this module. The "hosts allow" specifies the clients which can connect to server.

"Secrets file" gives the username & password of the user connecting, "max connections" represents the maximum number of clients which can connect simultaneously. If "use chroot" is true, the Rsync server will chroot to the "path" before starting the file transfer with the client. Timeout option is for I/O timeout for this module.

2. The file /etc/rsyncd.secrets can be like this containing the username and password with a colon in between on the client side i.e.

username : yourpassword

3. To create an empty file /etc/rsyncd.pid to place the process related arguments.

Some examples of how you can run rsync from the client side are as follows:

#rsync -avzrpog username@hostname.domain::modulename /path/to/put-data \

--password-file=/root/password --safe-links