Backup of a Linux desktop on a Synology NAS (DS 5.2) using backintime

1

2

I am trying to setup a backup of my Linux desktop machine on a Synology NAS with backintime.

However, I am stuck with the following error message:

Entfernter Rechner <nas.ip.address> unterstützt 'rsync -rtDH --links --no-p --no-g --no-o  --dry-run --chmod=Du+wx /tmp/tmpAOVRI9 --rsh="ssh -p 22 " "<user>@<nas.ip.address>:/volume2/backup"' nicht:
3072

Translation:

Remote server <nas.ip.address> does not support 'rsync -rtDH --links --no-p --no-g --no-o  --dry-run --chmod=Du+wx /tmp/tmpAOVRI9 --rsh="ssh -p 22 " "<user>@<nas.ip.address>:/volume2/backup"':
3072

Setup:

  • Synology NAS: DS214play, running DS 5.2-5644
  • Desktop: Linux Mint 17.2
  • backintime: v1.0.34

What I have done so far:

  • I have setup the NAS, so I can login as <user> using the users public ssh key. (Thus, ssh -p 22 <user>@<nas.ip.address> works fine.)
  • I got sshfs working, so sshfs -p 22 -o ServerAliveInterval=240 -o idmap=user <user>@<nas.ip.address>:/ </mountpoint/ works fine. (However, sshfs -p 22 -o ServerAliveInterval=240 -o idmap=user <user>@<nas.ip.address>:/volume2/backup </mountpoint/ fails with <user>@<nas.ip.address>:/volume2/backup: No such file or directory, even though the directory exists on the nas.

When I run the command above in a shell on the desktop, I get the following error message (I've also tried without volum2/backup but the result is the same):

rsync -rtDH --links --no-p --no-g --no-o  --dry-run --chmod=Du+wx /tmp/tmpAOVRI9 --rsh="ssh -p 22 " "<user>@<nas.ip.address>:/volume2/backup"
Permission denied, please try again.
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(226) [sender=3.1.0]

Thomas

Posted 2015-11-05T17:09:12.993

Reputation: 161

Answers

2

There was a very good wiki about setting up a Synology NAS for BackInTime that I always linked. But that is gone (at least it doesn't show up anymore, history is still available). So I will add it here


Issue

BackInTime cannot use Synology DSM 5 because the SSH connection to the NAS refers to a different root file system than SFTP does. With SSH you access the real root, with SFTP you access a fake root (/volume1)

Solution

Mount /volume1/backups to /volume1/volume1/backups

HowTo

  • Make a new volume named volume1 (if it doesn't exist yet)
  • Enable User Home Service (Control Panel / User)
  • Make a new share named backups on volume1
  • Make a new share named volume1 on volume1 (It must be the same name)
  • Make a new user named backup
  • Give to user backup rights Read/Write to share backups and volume1, permission for FTP
  • Enable SSH (Control Panel / Terminal & SNMP / Terminal)
  • Enable SFTP (Control Panel / File Service / FTP / SFTP)
  • Since DSM 5.1: Enable Backup Service (Backup & Replication / Backup Service)
  • Log on as root by SSH
  • Modify the shell of user backup. Set it to /bin/sh
  • Make a new directory /volume1/volume1/backups

    mkdir /volume1/volume1/backups
    
  • Mount /volume1/backups on /volume1/volume1/backups

    mount -o bind /volume1/backups /volume1/volume1/backups
    
  • To auto-mount it make a script /usr/syno/etc/rc.d/S99zzMountBind.sh

    #!/bin/sh
    
    start()
    {
           /bin/mount -o bind /volume1/backups /volume1/volume1/backups
    }
    
    stop()
    {
           /bin/umount /volume1/volume1/backups
    }
    
    case "$1" in
           start) start ;;
           stop) stop ;;
           *) ;;
    esac
    
  • On the workstation on which you try to use BIT make SSH keys for user backup, send the public key to the NAS

    ssh-keygen -t rsa -f ~/.ssh/backup_id_rsa
    ssh-add ~/.ssh/backup_id_rsa
    ssh-copy-id -i ~/.ssh/backup_id_rsa.pub backup@<synology-ip>
    ssh backup@<synology-ip>
    
  • Now you can use BackInTime to perform your backup to your NAS with the user backup.

Disclaimer: I'm member of BIT Dev-Team

Germar

Posted 2015-11-05T17:09:12.993

Reputation: 206

It is also very important to check that home folder permissions on Synology are 755 (drwxr-xr-x). Otherwise ssh with key won't work and ask password instead. By default home folder was created with 777 permissions in my case (DSM 6.1). – yves – 2017-03-26T18:49:43.963

0

In addition to the solution of Germar, I had to add a custom rsync flag in the profile settings:

  • Go to "Export options"
  • Check "Paste additional options to rsync"
  • Add --rsync-path=/path-to-rsync/rsync in the text field beside

On my Synology station rsync is located at /bin/rsync.

namnor

Posted 2015-11-05T17:09:12.993

Reputation: 1