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.
-
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.
-
Installing Rsyncd
- Install the
rsync
daemon with the following command:sudo apt install rsync -y
.
- Install the
-
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
-
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
- To enable PasswordAuthentication for the "backupuser," edit the SSH configuration file:
-
Restarting SSHD
- Restart the SSHD service to apply the changes:
sudo systemctl restart sshd
.
- Restart the SSHD service to apply the changes:
-
Creating an Rsyncd Configuration File
- Switch to the "backupuser" account:
sudo su backupuser
. - Create an
rsyncd.conf
file in the backupuser home directorynano ~/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.
- Switch to the "backupuser" account:
-
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.
-
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.