Backup to the Synology Server using DeltaCopy with SSH

From SynologyWiki
Jump to: navigation, search

Introduction

This guide will cover how to use DeltaCopy, a Windows rsync Client, with SSH Encryption to backup user data to the Synology product. This guide will also instruct in the creation of automated schedules.

The purpose of using DeltaCopy is to allow remote users to backup to their Synology system, such as when users are traveling on business trips, or stationed at remote offices.

DeltaCopy.jpg

This guide assumes the following

  • That Network Backup Services is Enabled on the Synology product
  • That Telnet or SSH Services is enabled on the Synology product
  • That you are familiar with the Synology Web Management Menu, and that you know how to manipulate permissions on the server
  • That you are familiar with performing file management functions, such as copying files from one location to another
  • That for the remote server, ports are forwarded as necessary
    • Data Port: 873
    • Encrypted Data Communications: 22
  • That you are familiar with manipulating Anti-Malware software to grant access to these Internet programs. Some Anti-Malware programs for example are:
    • Norton/Mcafee/AVG Anti-Virus Applications
    • Norton/Mcafee/AVG Internet Security Applications
    • Windows Firewall
    • Windows User Account Control
    • Windows Defender
    • ZoneAlarm
    • etc.
  • While not required: an understanding of Windows/Linux/Unix commands is recommended


Note: if SSH is not required, please refer to the steps that are colored purple

Software Requirements

The Synology server must be at firmware 2.0.3-0518 or above
DeltaCopy
cygwin
UNICODE enabled cygwin DLL (for those of us that need to backup files w. special characters ie. with umlauts and such.)


Install DeltaCopy

Step 1:

Execute DeltaCopy Setup

DeltaCopySSH.01.01.gif

Step 2:

Enter the Registration information
Note: it is recommended to install for all users

DeltaCopySSH.01.02.gif

Step 3:

Change the destination folder to the following

C:\Program Files\DeltaCopy\
DeltaCopySSH.01.03.gif

Step 4:

Review your changes, and finish DeltaCopy Setup

DeltaCopySSH.01.04.gif


Install Cygwin

Step 1:

Execute Cygwin Setup

DeltaCopySSH.02.01.gif

Step 2:

Set to Install from Internet

DeltaCopySSH.02.02.gif

Step 3:

Set the Root Directory to

C:\Progra~1\Cygwin
  • Install for All Users
  • Default Text File Type is Unix/Binary
DeltaCopySSH.02.03.gif

Step 4:

Leave the Local Package Directory to Default

DeltaCopySSH.02.04.gif

Step 5:

Use Direct Connection
Note: You may have to adjust this setting if necessary, depending on your network configuration

DeltaCopySSH.02.05.gif

Step 6:

Select a server to to install from. If none are present, use this one below

ftp://ftp.planetmirror.com
DeltaCopySSH.02.06.gif

Step 7:

Setup is acquiring the file list...

DeltaCopySSH.02.07.gif

Step 8:

Add the following items to be installed

Admin\cygrunserv
Net\OpenSSH
Net\OpenSSL
DeltaCopySSH.02.08.gif
DeltaCopySSH.02.09.gif

Step 9:

Setup is progressing...

DeltaCopySSH.02.11.gif

Step 10:

Create a desktop icon and click Finish

DeltaCopySSH.02.12.gif

Step 11:

To enable support for unicode characters download the unicode Cygwin dll and copy it to the DeltaCopy directory replacing the non unicode one.


Creating a SSH-Key

This section can be skipped if SSH is not required

Step 1:

Execute Cygwin, from your Desktop

DeltaCopySSH.03.01.gif

Step 2:

Type into the BASH command prompt

ssh-keygen

Step 3:

DO NOT type in anything else. Just press the "ENTER" key until the application is finished and a key was generated and saved. Refer to the image for an example
Note: The key-finger print has been removed in the image
id_rsa is your Private Key, this remains on your computer
id_rsa.pub is your Public Key, this will be installed in the Synology Server

DeltaCopySSH.03.02.gif


File Manipulation Tasks

Steps 1, 2, 3 may be skipped if SSH is not required

Step 1:

Go to the following folder C:\Program Files\cygwin\home\UserProfileName\.ssh

  • Note: UserProfileName is the name of your Windows User Profile, it is a variable and will be different for each user

Step 2:

Move id_rsa.pub to \\DiskStation\NetBackup\

  • Note: DiskStation is the name of the Synology product, please adjust accordingly


The final location should be

\\DiskStation\NetBackup\id_rsa.pub

Step 3:

Move id_rsa. to C:\Program Files\DeltaCopy\
The final location should be

C:\Program Files\DeltaCopy\id_rsa


Step 4:

Go to C:\Program Files\cygwin\bin
Copy the following files to C:\Program Files\DeltaCopy
Overwrite older versions if necessary

cygcrypto-0.9.8.dll
cygminires.dll
cygpopt-0.dll
cygz.dll
ssh.exe


The final location should be

C:\Program Files\DeltaCopy\cygcrypto-0.9.8.dll
C:\Program Files\DeltaCopy\cygminires.dll
C:\Program Files\DeltaCopy\cygpopt-0.dll
C:\Program Files\DeltaCopy\cygz.dll
C:\Program Files\DeltaCopy\ssh.exe


Creating Authorized Keys on the Synology Server

This section can be skipped if SSH is not required

Step 1:

Telnet or SSH into the Synology Product as root and perform the following

> cd /root
> mkdir .ssh
> mv /volume1/NetBackup/id_rsa.pub /root/.ssh/authorized_keys
> chmod 700 /root/.ssh
> chmod 600 /root/.ssh/authorized_keys
> chown -R root /root/.ssh
> chown -R root /root/.ssh/authorized_keys

Step 2:

Attached is the image of the final result

DeltaCopySSH.04.01.gif


Authentication of Keys between the client computer and the Synology Server

This section can be skipped if SSH is not required

Step 1:

Go to [Start] --> [Run] --> Type cmd
Then type the following

> cd \Program Files\Deltacopy
> ssh -i id_rsa root@192.168.0.12

Where id_rsa is the path of your private key
Where 192.168.0.12 is the IP address of the Synology product

Step 2:

Type yes to add the server to the list of known hosts
Ignore the Permission denied message; this is normal.
If you are prompted for a password, then authentication has failed. Create a new key and repeat the process of importing the key into the Synology product. Be sure to delete the old key before importing the new key, and make sure that all of the permissions and ownwership is set correctly.
Note: The key finger print was removed in the image.

DeltaCopySSH.05.01.gif


Configuring DeltaCopy

Step 1:

Launch DeltaCopy Client

DeltaCopySSH.06.01.gif

Step 2:

Double Click on Add New Profile and enter in the following information

  • Profile Name: A name for the profile, such as Synology Backup
  • Server IP/Host Name: The IP address or DNS Address of the Synology Product.
  • Virtual Directory Name: Set to /var/services/NetBackup
    • Set to NetBackup if SSH is not being used

Then click Add Profile

DeltaCopySSH.06.02.gif

Step 3:

Click on the Authentication Tab

  • User ID = Set to root
  • Password = Set to the Administrative password of the Synology Product
  • Note: Currently only root or rsync have the ability of writing data to the Synology Server
DeltaCopySSH.06.03.gif

Step 4:

Skip this step if SSH is not being used
Click on the Options Tab
Enable Connect via SSH Go to Additional Parameters: and add the following code

-e "ssh -l root -i id_rsa"
  • Note: id_rsa is the path to your private key, in this case, it is relative to C:\Program Files\DeltaCopy which is why id_rsa was placed into that folder.
DeltaCopySSH.06.04.gif

Step 5:

Click on File List and then proceed to click Add Folder
Add which folders that you would like to backup
For folders with spaces in the folder name, proceed with the nested instructions

DeltaCopySSH.06.05.gif

Step 5.1:

Right-click on the folder which has space in it's name, and click on Modify Target Path

DeltaCopySSH.06.06.gif

Step 5.2:

Modify the target path to have a BACKSLASH (\) BEFORE the space. Please refer to the examples

test Data/

Becomes

test\ Data/
DeltaCopySSH.06.07.gif

Step 5.3:

Skipping this step will result in a backup folder named test instead of test Data.

Step 6:

Right-Click on your profile name, and proceed with Run Now

DeltaCopySSH.06.08.gif

Step 7:

The system will then perform a backup with the following window displayed. Attached is a sample log file
Note:

  • "root@192.168.0.12:/var/services/NetBackup/test\ Data/" is part of the first line, but moved to the second line due to space limitations
  • The example below outlines a SSH-based connection, Non-SSH users will see a different command line.


Executing: rsync.exe  -v -rlt -z --delete -e "ssh -l root -i id_rsa" "/cygdrive/D/test Data/" __
"root@192.168.0.12:/var/services/NetBackup/test\ Data/"
building file list ... 
done

created directory /var/services/NetBackup/test Data
./
2007.02.02.Lake Wenatchee/
2007.02.02.Lake Wenatchee/img_0324.JPG
....FILES THAT WERE COPIED....
sent 55675368 bytes  received 754 bytes  1661973.79 bytes/sec
total size is 56813443  speedup is 1.02
Profile 'taurus' executed in 32718 milliseconds. It ran successfully.
DeltaCopySSH.06.09.gif

Step 8:

Here is the view of the data that was backed up

DeltaCopySSH.06.10.gif

Step 9:

To create a schedule, perform the following.

  • Note: Make sure that Windows has the ability of writing new schedules and running schedules
  • a) Click on Modify Schedule
  • b) Click on New
  • c) Enter the when your schedule should start
  • d) Enter the frequency of your schedule
  • e) Click Apply
  • f) Windows will display a new prompt, enter the Username and Password to execute the task under
  • g) Click Ok to all Windows, close all windows, and you are done with creating an automated schedule of using DeltaCopy to backup your data to the Synology Product
DeltaCopySSH.06.11.gif


Notes

Multiple Computers

This note may be ignored for non-SSH users
A key will have to be made for each user. For the authorized_keys file, append the file so it has keys from each of the public keys, do not create multiple files in /root/.ssh/. A recommended program to use to append the authorized_keys is Notepad++; be sure to disable word wrapping when editing the file. One key per line please! An example of the final outlook of /root/.ssh/authorized_keys is provided below

ssh-rsa ***Key here***== user1@machine1
ssh-rsa ***Key here***== user2@machine2


Known Limits

DeltaCopy, as it depends on Cygwin, does not support unicode characters without the special unicode cygwin.dll, or paths larger than 255 characters

Personal tools
Community Resources