Skip to content

Instantly share code, notes, and snippets.

@mrl22
Last active January 31, 2024 18:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrl22/476d710fea63d71a770d0d44ca54325a to your computer and use it in GitHub Desktop.
Save mrl22/476d710fea63d71a770d0d44ca54325a to your computer and use it in GitHub Desktop.
Backup your Synology to Linux with Encryption using Hyper Backup

How to Backup Your Synology to Linux with Encryption Using Hyper Backup

This guide has been created to assist those seeking a solution for backing up their Synology NAS to an offsite Ubuntu 22.04 server. Many guides are available for achieving this without encryption, but this guide focuses on incorporating encryption for added security.

Configuring Linux

  1. Setting Up Your Ubuntu Server

    • Begin by configuring your Ubuntu server in the usual manner.
    • Ensure that SSHD is running on a port of your choice, making sure the chosen port is open in the firewall or, for enhanced security, allow access from the public IP of your Synology NAS.
    • It's recommended to disable PasswordAuthentication for improved security.
  2. Installing Rsyncd

    • Install the rsync daemon with the following command: sudo apt install rsync -y.
  3. Creating a Backup User

    • Create a user account for storing your backups. In this example, we'll use "backupuser" with a home directory of "/home/backupuser".
    • To create the user, execute the following commands:
      sudo useradd backupuser
      sudo passwd backupuser
      
  4. Allowing Password Authentication

    • To enable PasswordAuthentication for the "backupuser," edit the SSH configuration file: sudo nano /etc/ssh/sshd_config.
    • Add the following lines to the end of the file:
      Match User backupuser
      PasswordAuthentication yes
      Match all
      
  5. Restarting SSHD

    • Restart the SSHD service to apply the changes: sudo systemctl restart sshd.
  6. Creating an Rsyncd Configuration File

    • Switch to the "backupuser" account: sudo su backupuser.
    • Create an rsyncd.conf file in the backupuser home directory nano ~/rsyncd.conf.
    • Insert the following contents:
      [/home/backupuser]
        path = /home/backupuser
        comment = Backup
        uid = backupuser
        gid = backupuser
        read only = no
        list = yes
        charset = utf8
      
    • Note that the rsync service does not need to run on port 873. The concept is that your Synology NAS will log into SSH, then run rsyncd based on the rsyncd.conf file in your home directory.

Configuring Synology Hyper Backup

  1. Logging in to Your Synology

    • Log in to your Synology DiskStation.
    • Open Hyper Backup and click the plus sign to create a new data backup task.
  2. Selecting Rsync or Rsync Copy

    • Choose either "rsync" or "rsync copy" as the backup task type.

    • Follow the setup steps, and configure the remote server settings as follows:

    • Server type: Rsync-compatible server

    • Server name: Enter the server IP or hostname of your Linux server.

    • Transfer Encryption: Ensure it is set to "On."

    • Port: Specify the SSH port of your Linux server.

    • Username: Your SSH username.

    • Password: Your SSH password.

    • Backup module: Use /home/backupuser. Note that sometimes the dropdown may not show any results, type /home/backupuser into the box.

    • Directory: This is your choice; for instance, if you set it as "backup," it will create a directory at /home/backupuser/backup.

If everything is correctly configured, you should see "Target: On-line," and the backup process should initiate successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment