I'm trying to set up a backup system from an Ubuntu server to a Synology NAS (DS413j) using rsync and sftp.

I have created a user for this that we can call ubuntu-backup. I have a directory in ubuntu-backup home directory called www where the backup will be saved. I have enabled Network Backup in DSM The user ubuntu-backup has full access to it's home directory

Here is my rsync config file on the Synology NAS:

#motd file = /etc/rsyncd.motd
#log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
use chroot = no
path = /var/services/NetBackup
comment = Network Backup Share
uid = root
gid = root
read only = no
list = yes
charset = utf-8
auth users = root
secrets file = /etc/rsyncd.secrets

path = /volume1/homes/ubuntu-backup/www
comment = Ubuntu Backup
uid = ubuntu-backup
gid = users
read only = false
auth users = ubuntu-backup
secrets file = /etc/rsyncd.secrets

The permissions on /volume1/homes/ubuntu-backup/www is ubuntu-backup:users 777

Here is the command i'm running.

rsync -aHvhiPb  /var/www/ [email protected]:./

The result:

sending incremental file list
ERROR: module is read only
rsync error: syntax or usage error (code 1) at main.c(1034) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]

If I'm running this:

rsync -aHvhiPb  /var/www/ [email protected]

It looks like its sending files. No errors. But I cant find anything on the NAS.

1 Answer 1


rsync doesn't do SFTP. From the man page:

   There  are  two  different  ways for rsync to contact a remote system:
   using a remote-shell program as the transport (such as ssh or rsh)  or
   contacting  an rsync daemon directly via TCP. 

SFTP doesn't give you a shell, ergo it doesn't work for rsync. You'll need an SSH connection instead.

Once you've allowed SSH connections, you may need to specifically tell rsync to use SSH. There are a few ways to do that:

rsync -aHvhiPb --rsh=ssh  /var/www/ [email protected]:./


rsync -aHvhiPb  "ssh -l ubuntu-backup"  /var/www/ backup.example.com:./

There are a lot more examples in the man page for rsync.

In the second example, it's syncing the files into a directory named [email protected] located in the direct. In order to specify a remote server, you should use a colon somewhere in the specification.

  • I set the user ubuntu-backup to /bin/sh and I can now login with ssh manually. But rsync will still not work.
    – Patrik
    Commented Oct 23, 2013 at 14:09
  • You may need to tell it specifically to use ssh - I'll amend my answer.
    – Jenny D
    Commented Oct 23, 2013 at 14:21
  • Ah yes! It finally works now. Thanks! Here us my final command: rsync -aHvhiPb --rsh=ssh /var/www/ [email protected]:/volume1/homes/ubuntu-backup/www
    – Patrik
    Commented Oct 23, 2013 at 14:34
  • Kul att det funkade!
    – Jenny D
    Commented Oct 23, 2013 at 14:37

You must log in to answer this question.

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