Skip to content

Instantly share code, notes, and snippets.

@h4cc
Last active June 17, 2017 18:12
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save h4cc/e86e7d9b3a696e5b9ddb to your computer and use it in GitHub Desktop.
Save h4cc/e86e7d9b3a696e5b9ddb to your computer and use it in GitHub Desktop.
Backups with Ubuntu BackInTime onto a Synology DSM5 via SSH

Howto

Source: http://wiki.qedinux.be/index.php?title=BackInTime_to_Synology_DSM_5 and: http://techanic.net/2014/04/12/configuring_ssh_and_scp_sftp_on_dsm_5.0_for_synology_diskstations.html

WARNING

Not everything here is explained. You need to know what you do. Also: DSM Updates will change your settings!

Steps

  • 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

and make it executeable:

chmod +x /usr/syno/etc/rc.d/S99zzMountBind.sh 
  • Make sure the persissions are correct for SSH
chown 755 /volume1/homes/backup
chmod 700 /volume1/homes/backup/.ssh
chmod 644 /volume1/homes/backup/.ssh/authorized_keys
  • 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment