1

I am trying to set up a backup from my NAS (QNAP TS-469 Pro) to my PC running Ubuntu 16.10, using the "Backup Station" offered by the NAS.

If I ssh to the NAS and run the following commands, the rsync works:

touch file.txt                             # Create "file.txt" on the QNAP 
rsync file.txt username@ipaddress:~        # Backup "file.txt" on the backup PC

However, when setting up a backup from the GUI of the NAS (in a browser), I get the error

Invalid port number or the service is disabled.

I read some things about port 873 or running a rsync daemon, but all this is very unclear for me.

Why does running rsync manually works, while I get an error with the "Backup Station"? Of course in the end, I am interested in making the automatic backup work.

2 Answers 2

2

Rsync can work in two different modes:

  • via SSH: Rsync connection (both for control and data transfer) inside an SSH tunnel (basically using pipes). Due to the ubiquity of SSH access, and its security, this is often the preferred approach. However, to be truly transparent and automated (with no password required), you had to setup RSA authentication. Moreover, as all the data is encrypted by SSH, it can be slower than the other approach;
  • via daemon (or service) mode: On the remote system, Rsync runs as a daemon/service, listening on port TCP 873. This mode has no build-in encryption and so it is both faster and less secure than the SSH tunnel. It is the mode used by QNAP for local and remote backups. To let QNAP use your PC as its backup target (ie: backup the NAS on the PC), you need to enable the Rsync service on your PC. While not difficult, it surely is more complex than a simple SSH tunnel. You can find more information on the net, for example here.
1
  • Both answers are very good. Accepted this one because of the link to the excellent tutorial, which is more general than the explanations given by Aaron. Thank you both.
    – anderstood
    Jan 25, 2017 at 16:25
3

You are probably getting rsync over rsync vs rsync over ssh confused.

Rsync over SSH (using your ssh config)

rsync -av file.txt username@ipaddress:~

This method traverses an SSH channel and is encrypted.

Rsync over Rsync using the standard rsync protocol

rsync -av file.txt ipaddress::myhome/.

The later assumes you have set up rsyncd.conf and started rsync as a daemon. As a daemon, all of the authentication/security is defined in rsyncd.conf and this does not use encryption.

The easy way to spot the difference is the two colons after the address and the share name after the two colons.

Here is a really simple and dangerous example of rsyncd.conf (simple, because root and permissions are not an issue. dangerous, because running as root and not chroot)

uid = root
gid = root
use chroot = no
max connections = 64
lock file = /var/tmp/rsyncd.lock
syslog facility = local5
pid file = /var/tmp/rsyncd.pid 
strict modes = false
hosts allow = 192.168.120.2
timeout = 60
dont compress = *.xz *.gz *.tgz *.zip *.rpm *.bz2 *.7z *.rar *.jp* *.gif *.png *.avi *.mp* *.wmv *.asf *.flv *.m4v *.mkv *.mov *.ogm *.rm *.3g*
#refuse options = checksum delete
refuse options = delete
#
[myhome]
list = false
comment = "myhome"
path = /home/myself/mydir
read only = no

And here is me starting said daemon:

#!/bin/bash
set -o posix
set -u
# keep nagios happy
renice 19 -p $$ > /dev/null 2>&1
ionice -c3 -p $$ > /dev/null 2>&1
rsync --daemon --ipv4 --address=192.168.120.1 --config=/home/myhome/rsyncd.conf --log-file=/dev/shm/rsync.log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .