Help for Rsync server menu

 

Rsync can be also used as a daemon. In this configuration, copying files with the rsync utility in client server mode uses the rsync utility on the initiating side and an rsyncd on the server side. The amount of data transferred between client and server is optimized for file copy across a slow (internet) connection and also when resources are limited (ie low speed CPU).

Note: You can find some useful guides how to use rsync with advanced options on the plugout board (Rsync: Guides & Tutorials)

I - Rsync Server menu

This new menu allows you to set the rsync server configuration :

Warning : as the rsync protocol is not safe (transfer flux without encryption) you should use it only on your LAN. By default, the connections from remote hosts are disallowed in the configuration.
If you want to use it across an Internet connection, you must use it via a remote shell connection (see the chapter "Use Rsync server via a remote shell connection").

II - How use the rsync server

On the client side, you must use rsync commands from a shell terminal. For linux or MAC, rsync is usually available. From operating windows systems, you can install, for example, cygwin which allows to implement a fake shell and in our case also rsync (see the chapter "Install cwrsync and use rsync with windows").

 

On the client side open a shell terminal (or Putty if the client is another NAS, or cygwin Terminal for windows OS) and give the following commands for :

  1. List the available modules:

    login is any name, nasname is the ip or the host name where the rsync server is running. Note the double ":" and you get this output :

  2. List the content of a module or a subfolder:

    or with a subfolder


    login is only an authorized authentication. In this case, the server asks you to give the related password (see the chapter 'How use a password file' for giving directly the password).
     modulename is the sharename of an available share and the output is :

  3. Synchronize a local folder with your NAS:
     To copy a local folder to the NAS
     
    To copy a NAS content to your local folder:

    [backup options]
    common rsync options used :
    -a : usually used. Note: don't use this option if client's OS is windows and replace it by -rlt (never use the options p, o and g)
    -z : to compress file before sending. I advice you not to use it if you backup from the NAS (transfer speed is lower in this case : not enough resource to do that)
    --delete : use it to get an perfect copy between source and destination. In destination, all file will be deleted if  it doesn't exist in source folder
    --stats : to get some transfer statistic
    -v : to get a verbose output
    --port=PORT use it only if the server doesn't listen the default port (873) and PORT is the value of your custom port

    Of course, you can use these lines with cron or in any shell file.
    If you want to save the output (stats) make a redirection : add at the end of the command line : > 'pathto..yourlogfile'

    From an OS windows, see the chapter "Install cwrsync and use rsync with windows"

III - How use a password file

You can add the option : --password-file='pathto..yourpassfile' to give directly the password (useful with a shell script or cron). This file must contains only the related password of the login that you want to use to access to the module (not space or break line).

Before using it, rsync checks if the file is readable only by the account with which it runs. Otherwise you get this error message:
 

So on a linux system, you must check if password file owner is the same than this one used to run the rsync command line and its permissions must be 600.

 

Note : if you make a copy from another NAS with fvdw-sl firmware, root must be the owner of the password file and have the permissions 600 (or rw------- )
 

For OS windows, see the chapter "Install cwrsync and use rsync with windows"

IV - Use Rsync server via a remote shell connection

Using rsync daemon over a remote shell connection is relatively simple : you use the same command line and you must add only one option : 'e' to set which ssh client to be used.

When you used this features, it's not the current rsync daemon but a dedicated daemon started by the ssh client. So you can used this feature even if the rsync server is not running. It will used the parameters saved in the nas database. Of course, if you never saved a configuration, you can't use it !

The options to declare with the ssh client are depending the ssh server configuration of your NAS (see the chapter SSH Access help page) :

Note : if you use this feature between two NAS with our firmware, for using option '-e':

So the rsync command lines are for example :

V - Install cwrsync and use rsync with windows

After selecting these additional packages, the install program will propose you to add also some dependencies packages (you must accept them!)

Note: you can also add in the PATH environment, the path : c:\cygwin\bin to get a direct access to the shell commands (rsync, nano,...) in a DOS window.

 

To use easily rsync, open a cygwin Terminal and you get a similar Linux environment. You can use this terminal as Putty and basic shell commands are also available.

 

For managing local path, I advice you to forget the windows syntax and always use linux syntax (use '/' instead of '\')

To access of your local disks, you must always begin the path by /cygdrive. So to access to a folder of the disk c:, the path will be : '/cygdrive/c/Documents and Settings' . Note : the path string is not sensitive case and use simple quote if the path contains space chars.

Important : You must always use this syntax for the password file path otherwise you will get the error message about read permissions

 

You can also use rsync in  a batch file :
Create a txt file (with notepad, or notepad++,...) and save it with the extension bat and copy these lines :

 

These lines copy a folder from the NAS to a local folder and delete all file in the local folder if it doesn't exist in the NAS folder (option --delete). Swap the order between '/cygdrive/pathto..localfolder' and login@nasname::module/pathto..folder to copy from the client side to your NAS

Note 1: if in the used path you have not ASCII characters, the bat file must be encoded in 'OEM 850' or use directly the very old console 'edit.com' ;-)

 

Note 2: if you redirect the rsync output in a file you must use Windows syntax (ie: > "c:\Documents and Settings\username\My Documents\rsync.log"). Use also double quote in this case