In one of my previous posts I explained how you could backup data from an external server to your Synology NAS using rsync, however this was a very unreliable method as it was relying on changing the permissions of the Synology NAS.
The method that I will explain here relies on the permissions of a user on the external server only, which makes it a lot easier to set up.
In the test scenario that I will be presenting in this guide, I will be using the root user of the external server, so if you wanna use another user, make sure that the other user has access to the files that you would like to back up.
Before starting this guide, it is expected that you’ve already:
- Installed Active Backup for Business on your Synology NAS
- Installed rsync on your external server
Be aware that not all Synology NAS models are supported by Active Backup for Business.
Please see the following page for a list of supported models:
Let’s get started!
Start by running the following command as root to generate the key on your external server:
ssh-keygen -t rsa -b 4096
You will be asked where to save the key:
Enter file in which to save the key (/root/.ssh/id_rsa)
Press Enter, if you’d just like to use the default path.
Next, you will be asked to enter a passphrase:
Enter passphrase (empty for no passphrase):
Active Backup for Business does not support SSH keys with passphrases, so press Enter twice to create the SSH key without a passphrase.
Two files has now been created:
- id_rsa – This one will be used by Active Backup for Business
- id_rsa.pub – This one will be used by the External server
Now, rename the id_rsa.pub key to authorized_keys:
mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys
If you already have an authorized_keys file, just add the line from the id_rsa.pub file to the existing authorized_keys instead.
Move the id_rsa file to a separate location where it is reachable while configuring Active Backup for Business.
We are now ready to move on to Active Backup for Business on your Synology NAS:
- Open it and go to File Server and press Add Server
- Select rsync server and press Next
- Enter the details of your external server
- Server Address – The address that you’re able to reach your external server from
- Connection Mode – rsync shell mode via SSH
- Port – The port used by SSH and rsync. For improved security, I would highly recommend changing this from the default, 22.
- Account – In our scenario this is root
- Auth Policy – SSH Key
- SSH key – Upload the SSH key (id_rsa) file
- Press Apply and you’re now connected to the external server and are able to choose from a variety of backup options, what files and folders to back up and setup a schedule as well.
Please let me know in the comments, if you get stuck, need further assistance or if you just found this guide helpful in any way! 🙂