Little howto of how to create a rsync server

First of all you need to open the port 873 to your machine

You need to configure a module for your rsync in the file /etc/rsync.conf the module is between the [ ] brackets, this is a example:

# sample rsyncd.conf configuration file

# GLOBAL OPTIONS

#motd file=/etc/motd
#log file=/var/log/rsyncd
# for pid file, dont' use /var/run/rsync.pid unless you're not going to run
# rsync out of the init.d script. The /var/run/rsyncd.pid below is OK.
pid file=/var/run/rsyncd.pid
#syslog facility=daemon
#socket options=

# MODULE OPTIONS

[thanafiles]
        comment = Welcome to the server of my files
        path = /home/thana/rsyncserver
        use chroot = yes
#       max connections=10
        lock file = /var/lock/rsyncd
# the default for read only is yes...
        read only = yes
        list = yes
        uid = nobody
        gid = nogroup
#       exclude = 
#       exclude from = 
#       include =
#       include from =
# The auth part is optional, if you want to use your server for ONLY some persons
        auth users = ignacio, susan
        secrets file = /etc/rsyncd.secrets
        strict modes = yes
#       hosts allow =
#       hosts deny =
        ignore errors = no
        ignore nonreadable = yes
        transfer logging = yes
        log format = %t: host %h (%a) %o %f (%l bytes). Total %b bytes.
        timeout = 600
        refuse options = checksum dry-run
        dont compress = *.gz *.tgz *.zip *.z *.rpm *.deb *.iso *.bz2 *.tbz

After you need to enable the rsync server, editing the file /etc/default/rsync and uncoment or change the line RSYNC_ENABLE to true

# defaults file for rsync daemon mode
RSYNC_ENABLE=true

And now if you launch /etc/init.d/rsync restart it needs to are launched without problems

The next step is to set the passwords of this users if you have enable it, you need to create a file called /etc/rsyncd.secrets with permissions of 640 (use chmod), this is one example:

ignacio:barras
susan:mysupapassword

Client usage

Your rsync server is running, now from another machine, you just need to launch a similar command:

mkdir test
rsync -avz --delete ignacio@thanatermesis.org::thanafiles test

Now it ask about the password of ignacio and if you enter it, you are downloading the things of the rsync server

What happens if you don't want to enter the password all the time because you want to put this command in a crontab job ? You can posible to make a file with the user and password, with permissions 640 and launching a similar line to:

rsync -avz --delete ignacio@thanatermesis.org::thanafiles test --password-file /home/ignacio/thanaserver.password

Aparently this works in ssh mode, but im looking now for this, don't finish to works for me