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! 🙂
27 comments on “Backup to Synology NAS with rsync using Active Backup for Business”
Colby TaylorDecember 24, 2019 at 07:58
Please dumb this down. You dont state where to type each command. Server or Synology side?
GnaXiDecember 24, 2019 at 12:00
All of the commands has to be performed on the server.
I will edit the post to make that more obvious! 🙂
Thank you for your feedback and let me know how it goes.
Colby TaylorDecember 25, 2019 at 04:55
Right after this I just went ahead and did all the commands on server side. It worked. My issue is with the root. I have setup a Zentyal Server (Ubuntu). It has samba installed with shares. It is a Linux Domain Controller. I can use ROOT and rsync to the synology, but I am unable to allow Synology to ask my server to send the files over via rsync. I can login and add the server to the Active Backup Software. But after creating a task I get an error on the backup. Pretty much saying its not allowed.
1st question: how do you add server with root username. If i type in the server username it works, but simply typing root in username does not
2nd question: i believe it would be easier to rsync from the server the the synology since that works. Do you have a tut or link to one on the best way to do this. Id like it versioned and NOT to delete. I know I could use snapshots. But Id prefer each day to backup to a new folder. Incremental Backups.
GnaXiJanuary 18, 2020 at 15:41
My apologizes for the late reply! Your comment ended up in my spam filter for some reason.
Regarding your first question, are you able to SSH to the server using root as a username? If so, you should also be able to rsync, as it’s using the same protocol in Synology’s Active Backup. If not, you have to make sure that SSH is actually allowed for the root user.
And for your second question, I actually have a guide of how to do it the other way around using just rsync, but the permissions that has to be changed on the Synology NAS via SSH tends to be a tad more complicated. But if you would like to give it a try, here is the guide:
tbJanuary 25, 2020 at 19:59
Thanks for your posts, very helpful. Unfortunately my model isn’t supported in Active Backup for Business. Perhaps add a link to the install for Active Backup for Business, https://www.synology.com/en-us/dsm/packages/ActiveBackup, which lists the model #’s.TB
GnaXiJanuary 25, 2020 at 21:12
Thank you for the feedback and suggestion! 🙂 I’ve added a small section regarding the supported models and where to find more information about it.
RainerFebruary 1, 2020 at 00:12
Thanks for this tutorial! Have you also an tutorial to setup rsync on the server correctly? I think, i did something wrong.
Also your syncd.conf might be helpful…
GnaXiFebruary 1, 2020 at 15:38
You’re very welcome! 🙂
The reason that I haven’t included any information about setting up rsync on the server, is because it doesn’t require any configuration or changes to work.
As Active Backup for Business is the one doing the actual fetching of the data, you just have to make sure that the user actually has access to the files that you would like to fetch.
What issue are you experiencing?
RainerFebruary 1, 2020 at 20:01
Thank’s for your fast reply. I already solved my problem – and it was quiet easy: i just used the wrong port number 😉
Very very stupid…
GnaXiFebruary 1, 2020 at 23:19
Happens to the best of us! Thanks for the feedback and happy to hear that you got it working! 😀
Tom SchmittFebruary 15, 2020 at 08:34
I have installed Active Backup for Business on my DS218+.
When I enter the fields for the rsync server I enter the first five fields with no problems.
The SSH key Upload field takes me to my PC’s for file selection and not to the RPi-3 Linux server to find the ‘id_rsa’ file.
I cannot get the key for the server?
GnaXiFebruary 15, 2020 at 23:30
That is correct and exactly why I wrote the following in the guide:
If you are reaching your RPi-3 server via a terminal window, you could just simply open the id_rsa file with a text editor, copy the content and paste it into a text editor on your local machine.
Then save the file as id_rsa, so that you can attach it in the Active Backup for Business setup.
Tom SchmittMarch 2, 2020 at 21:55
I kept trying to get a good id_rsa file and I finally was able to get it to take it.
I then setup all the locations to be backed up.
Thanks for all your good work and your assistance!
GnaXiMarch 3, 2020 at 09:38
Happy to hear that you found the solution! 🙂
In your previous comment you mentioned the following step, which is incorrect:
cp id_rsa authorized_keys
You should be putting the id_rsa.pub into the authorized_keys, not the id_rsa.
The id_rsa is the one used by Active Backup for Business.
Tom SchmittMarch 2, 2020 at 21:33
I am still having the same problem – Help please!
I go to my RPi-3 Raspbian as root and run the ssh-keygen command.
cp id_rsa authorized_keys
cp id_rsa /root/tom-id_rsa
Then I move the file to the Win10 PC that I access the Synology ABFB app.
I then rename tom-id_rsa to id-rsa in c:\data directory
I then go to the ABFB app:
Server Address: IP-address of my RPi-3
Connection Mode: rsync shell mode via SSH
Auth Policy: SSH Key
SSH key: I hit UPLOAD and it takes me to the Win10 file system
I navigate to C:\data directory and select id_rsa and UPLOAD
I then get that it is either an id_rsa with a passcode or an illegal id_rsa key ????
Shouldn’t it take me to the IP address of the RPi-3 to find the id_rsa file and not the Win10 PC?
I am at a loss for now – I really want to rsync my Dell T105 server and my 3 Rpi-3 devices ASAP but am at a halt.
I have my 4 Win10 PC/Laptops working on the Synology packup for bare-metal restore so I would love to complete my backups for my Linux devices.
Thank you for your assistance in advance!
Am I making a simple mistake?
AndyMarch 4, 2020 at 19:10
I could successfully connect from NAS to my linux server, but when I want to save the backup task on the NAS the usiness Backup tells me “the destination folder does not support ACL”. What the… ?
Thanks for your help!
GnaXiMarch 6, 2020 at 23:03
Have you used the root user from your Linux server, when connecting to Active Backup for Business, or have you created a separate account?
If you’ve created a separate account, make sure that the user has all of the required permissions to the files that you would like to back up.
HendryMarch 12, 2020 at 09:03
Hi, may i ask you? I’m following your guide to backup my Ubuntu Server to my Synology NAS too. So i was using root account to setup the SSH key, and root account to when i enter the authentication on Active Backup for Business. I intend to backup my whole Ubuntu Server, so i need to backup every folders and files in it.
It has successfully connected with the NAS, but when it backing up, it just says partially complete, and when i check the log, most of them says “failed to read the file”.
Can you help me?
Thanks in advance
ZebraJune 13, 2020 at 02:15
i have the same, did you solve it?
GnaXiJune 19, 2020 at 22:28
I highly doubt that you would be able to make a copy of the entire operating system, even as root.
I honestly don’t even see why you would do that? But what paths specifically is it complaining about?
LaurentNovember 2, 2020 at 20:13
Hello, like Tom Schmitt, I followed all your tuto and always get the message “The SSH key is invalid or you are using a SSH key with passphrase” when opening the key from my W10 PC.
If I modify the server for password auth, ABFB connects, but never with a SSH Key.
From my PC I’m perfectly able to connect with Putty to my Debian server with a SSH key
What could be the problem with Syno ? Is there a new version of ABFB since your tuto ? Do I need to have the private key on the Syno before ?
Thanks for your help, I’m driving crazy after 3 days of tries !!!
GnaXiNovember 2, 2020 at 20:28
I was actually able to reproduce this, if I just copied the content of the id_rsa file into a notepad document on Windows and saved it as id_rsa, instead of moving the id_rsa file from the external server via SFTP.
Could this possibly be the same for you?
I would imagine that the encoding that the file is being saved in that is the problem.
LaurentNovember 2, 2020 at 23:43
Well I created a text file and copy pasted the ASCII key from PuTTY to Notepad++ in Win 10 –> error in ABFB
If I use Filezilla for a SFTP transfer to Win –> error in ABFB
How should I get the key file on the Synology ?
LaurentNovember 3, 2020 at 00:03
I found the solution : in Notepad++ the file should be saved with EOL conversion set to UNIX !!!
Thanks for your help
gootApril 1, 2022 at 10:43
thanks! – Takes me a while to figure out that copy&paste from Linux to Windows is not working.
weird that in 2022 this is still a issue. I used winscp to copy the generated file to my local device.
LaurentNovember 3, 2020 at 00:38
as my ABFB is set, do you have recommandations to perform a full backup of a Debian VPS server ?
Like a PC Ghost, I’d like to set up a fresh server in a few minutes, in case of crash or compromise.
As I have websites backups, I would like to backup my fresh configured LAMP server (database, mail, ISPconfig, …).
I’m not an Unix guru, but I understand that I should boot my server in rescue mode and perform a “dd” command….
Is it sufficient and will my restore be bootable ?
Thanks for help.
GnaXiNovember 14, 2020 at 23:23
In smaller environment setups I don’t really see the point in having a finished image just lying around waiting to booted up from a new server.
It would within a very short time frame be outdated and you would have to use time on updating instead of just setting it up from scratch and if you’re using LAMP, setting it up from scratch doesn’t take very long.
If you still want to make one, I would suggest looking into Clonezilla. It’s open source and still under development.
My apologies for the late response. For some reason your comment ended up in my spam filter! 🙂