Comments on: Backing up Windows computers to a Synology NAS via SSH and rsync https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/ Home to Nic Jansma, a software developer at Akamai building high-performance websites, apps and open-source tools. Wed, 10 Feb 2021 14:25:20 +0000 hourly 1 https://wordpress.org/?v=5.5.3 By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1245505 Mon, 25 Mar 2019 01:57:53 +0000 http://nicj.net/?p=1090#comment-1245505 In reply to Kyle.

Hi Kyle!

You may need to install additional packages once Cygwin has been installed. In the version of Cygwin that I’m using, I have to run cygwin\setup-x86.exe.

Then search for package “ssh” and under the “Net” category you should find “openssh”.

Good luck!

]]>
By: Kyle https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1245487 Tue, 12 Mar 2019 13:40:00 +0000 http://nicj.net/?p=1090#comment-1245487 I’m having trouble finding the ssh.exe, ssh-keygen.exe and rsync.exe files in the cygwin /bin folder and anywhere on cygwin. Naturally that means I’m also struggling to find most of the dll files listed below those files as well.

If you maybe have a copy of these files hosted somewhere or could advise on where I might find them, that would be greatly appreciated. (I’m still learning all of this so forgive me if the answer is obvious)

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1245351 Fri, 11 Jan 2019 12:56:21 +0000 http://nicj.net/?p=1090#comment-1245351 In reply to Luuc.

Thanks @Luuc, fixed!

]]>
By: Luuc https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1245347 Wed, 09 Jan 2019 15:03:26 +0000 http://nicj.net/?p=1090#comment-1245347 Hi, thanks a lot for this tutorial. Otherwise I wouldn’t have been able to do this. One tip: your code keeps not displaying the first two letter of the line, when they are aligned to the left. Probably a lay-out issue (because they show up in html explorer). Just to help future linux explorers out!

]]>
By: JACK REACHER https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1237749 Thu, 30 Nov 2017 18:34:39 +0000 http://nicj.net/?p=1090#comment-1237749 You could use the built in encryption of the synology. When the share is mounted it will work as a normal folder in ssh.

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1221982 Sun, 07 Feb 2016 17:19:17 +0000 http://nicj.net/?p=1090#comment-1221982 @ Justin
Hi Justin. I think it might be a Cygwin “home” issue. Try the solution here? https://superuser.com/questions/735801/ssh-could-not-create-directory-home-username-ssh

]]>
By: Justin https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1221980 Fri, 05 Feb 2016 23:35:37 +0000 http://nicj.net/?p=1090#comment-1221980 Not Sure what I am missing.

When I run the the script I get two errors. once is Could not create directory ‘/home/username/.ssh’

It then says it cannot establish the authenticity of the host and comes up with a ECDSA key fingerprint and asks if I would like to continue. When Yes is entered it tells me that it could not add the host to the list of know host and then proceeds to upload files.

I am guessing I am missing something simple but for the life of me I cannot find it.

Help would be awesome.

Cheers,

Justin

]]>
By: LysanderM https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1221962 Fri, 22 Jan 2016 13:48:59 +0000 http://nicj.net/?p=1090#comment-1221962

Nic :Hi Rene. I haven’t had this problem yet (or haven’t noticed it with my files yet), but I was able to install iconv by doing the following: 1) Install ipkg (Possible instructions here http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc#How_to_install_ipkg) 2) Make sure you have gcc and make installed: ipkg install gcc make 3) Download iconv-1.14.tar.gz: http://www.gnu.org/software/libiconv/#TOCdownloading 4) Extract: gunzip iconv-1.14.tar.gz && tar xfv iconv-1.14.tar 5) Configure and make: cd iconv-1.14 ./configure make && make install

This is brilliant, thanks Nic.

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1207684 Wed, 19 Feb 2014 21:45:52 +0000 http://nicj.net/?p=1090#comment-1207684 @ Jan-Paul
Two things to try Jan-Paul.

One, you can try to escape the space with the \ character. eg: My\ Documents

I’m not sure, but DOS globs (wildcards) might work too, so you could potentially swap the space with a question mark (?‘) eg: My?Documents

Hopefully one of those will work for you!

]]>
By: Jan-Paul https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-1207683 Mon, 17 Feb 2014 15:23:07 +0000 http://nicj.net/?p=1090#comment-1207683 Tried and tested with success, thanks for sharing. My only question would be if you have any advice on how to escape spaces in the path names as I am trying to backup the “My Documents” folder. ‘%rsyncConnectionString%:%rsyncPath%/My Documents/’ doesn’t work as I would have expected. Any tips on this issue?

Kind regards, Jan-Paul

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-19187 Thu, 17 Jan 2013 04:03:36 +0000 http://nicj.net/?p=1090#comment-19187 Are you sure validate-rsync.sh starts with “#!/bin/sh” (without quotes) exactly?

Also, make sure the line-endings are in Unix mode and that the file is in ANSI (not UTF-8) mode. Both of those have caused me problems before.

]]>
By: Romain https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-15914 Sun, 13 Jan 2013 15:13:56 +0000 http://nicj.net/?p=1090#comment-15914 Hi Nic,

Thank’s for this great solution, it’s really working fast. I had some issue at first like BillB but it was because I tried not to use the root account. I ended using it and it works.
But I can’t use the validation-script, because I have the following error:

/root/.ssh/validate-rsync.sh: line 1: ?#!/bin/sh: not found
protocol version mismatch — is your shell clean?

If i had the line :

command=”/root/.ssh/validate-rsync.sh /volume1/backup/WIND”

In the authorized_keys file.
I can’t figure out why I get this error but It is certainly because of my config and not because of your script.
I checked the /root/.profile file and it seems ok (with /opt/bin and /opt/sbin in it).

If you have any clue it would be nice, for now I am using your script without the restriction to rsync.

]]>
By: Rene https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-11697 Mon, 07 Jan 2013 18:45:43 +0000 http://nicj.net/?p=1090#comment-11697 @ Nic
Hi Nic,
Thanks a lot for the instructions. But just yesterday I found out that my problem is not with rsync but with the mounting of the windows drive. Already after the mount, the characters were wrong. So for rsync it was like “grabage in, garbage out”. But just 10 minutes ago I found that the problem was that I tested with mount.cifs but used spaces in my command line and therefor the iocharset was not “seen”.
Now I use simple mount:
mount //$IPAddress/$SourceShare $MountDir -t cifs -o username=$Username,$Password=,iocharset=utf8
and that works fine.
Thanks again.

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-11578 Mon, 07 Jan 2013 14:00:29 +0000 http://nicj.net/?p=1090#comment-11578 In reply to Rene.

Hi Rene. I haven’t had this problem yet (or haven’t noticed it with my files yet), but I was able to install iconv by doing the following:
1) Install ipkg (Possible instructions here http://forum.synology.com/wiki/index.php/Overview_on_modifying_the_Synology_Server,_bootstrap,_ipkg_etc#How_to_install_ipkg)
2) Make sure you have gcc and make installed: ipkg install gcc make
3) Download iconv-1.14.tar.gz: http://www.gnu.org/software/libiconv/#TOCdownloading
4) Extract: gunzip iconv-1.14.tar.gz && tar xfv iconv-1.14.tar
5) Configure and make:
cd iconv-1.14
./configure
make && make install

]]>
By: Rene https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-10669 Sat, 05 Jan 2013 17:06:28 +0000 http://nicj.net/?p=1090#comment-10669 Hi,
I did not want to run anything special on the home PC’s and I am also sure that I will forget to run a backup on those PC’s. So I made this the other way around: The Syno is “pulling” the data from the PC’s by first mounting drives or folders from the PC to the Syno.
All works fine except one thing. If I have a file name with special characters, like in my name (René) the backup file gets a kind of underscore and is not accessible via windows explorer. I tried to add –iconv=utf-8,ISO88592 in the rsync command, iconv is not active or supported by the Syno.
Any suggestion to overcome this problem?
Thanks in advance

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9285 Sat, 15 Dec 2012 20:10:28 +0000 http://nicj.net/?p=1090#comment-9285 @BillB
I would use whatever comes from the .PUB file. Does your server give you more information about why it rejects the ssh-dss key?

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9284 Sat, 15 Dec 2012 20:07:12 +0000 http://nicj.net/?p=1090#comment-9284 @Mac
I just did a new install of Cygwin. I selected two additional packages besides the default: ‘rsync’ and ‘openssh’. The openssh package installed cygssp.dll into the cygwin\bin\ dir.

]]>
By: BillB https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9274 Mon, 10 Dec 2012 17:24:17 +0000 http://nicj.net/?p=1090#comment-9274 start-backup.cmd keeps prompting for password.
In authorized_keys it says ssh-dss. But generate-client-keys has ssh-keygen -t rsa. Should these be the same? When I changed ssh-dss to ssh-rsa it ran without passwd, but then copied files were unreadable.
Thanks for the post.
BB

]]>
By: Mac https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9272 Thu, 06 Dec 2012 06:28:15 +0000 http://nicj.net/?p=1090#comment-9272 hi nic
actually i am not that far. the problem occurs when executing the client script: generate-client-keys.cmd
thanks for advice.
best regards
markus

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9271 Wed, 05 Dec 2012 23:06:21 +0000 http://nicj.net/?p=1090#comment-9271 In reply to mac.

Hi Markus,

Newer versions of Cygwin may not need that DLL. Does the backup occurr successfully or is it complaining about cygspp-0.dll being missing?

]]>
By: mac https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9270 Wed, 05 Dec 2012 21:21:21 +0000 http://nicj.net/?p=1090#comment-9270 hi nic

i am trying to get this mentioned dll file “cygspp-0.dll”. but have a real hard time to find it.
could you give advice, helping to locate it?
all the other files where as expected found after installation of the current cygwin setup.

kind regards
markus

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9113 Mon, 05 Nov 2012 23:26:06 +0000 http://nicj.net/?p=1090#comment-9113 Glad it worked! Was it a typo in your script or in mine?

]]>
By: Grant https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9112 Mon, 05 Nov 2012 22:56:03 +0000 http://nicj.net/?p=1090#comment-9112 @ Grant

Never mind…fixed it 🙂
Found a typo.
Thanks anyway.

]]>
By: Grant https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-9111 Mon, 05 Nov 2012 22:45:41 +0000 http://nicj.net/?p=1090#comment-9111 Great post. Looks like just what I need if I could get it to work 🙂
I think I have it all set up correctly, but when I run the start-backup.cmd it fails
with a “Host key verification failed.” message.
If I run the ssh command on its own. it works fine:
eg.
ssh -i rsync-keys-mymedia -l root pwd
with the validate-rsync-.sh script only containing the line
$SSH_ORIGINAL_COMMAND
for testing.
Any idea what I could be doing wrong.
Note running alll this from a cygwin cmd shell.

]]>
By: Andreas https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-7993 Tue, 19 Jun 2012 19:17:56 +0000 http://nicj.net/?p=1090#comment-7993 @ Steve Upp

You could use the built in encryption of the synology. When the share is mounted it will work as a normal folder in ssh.

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-7503 Mon, 07 May 2012 19:55:23 +0000 http://nicj.net/?p=1090#comment-7503 In reply to Steve Upp.

I agree completely, and I’ve been pondering what the solution would be. It’d be nice to have the clients have their own keys that they could use to mount a filesystem (or a .TC filesystem file) before the rsync, and then unmount afterward. There’s always a trade-off between full-automation and security. Anything that is fully automated still has the possibility of being infiltrated and then that system could be used to infiltrate further.

Let me know if you come up with anything!

]]>
By: Steve Upp https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-7502 Mon, 07 May 2012 11:46:04 +0000 http://nicj.net/?p=1090#comment-7502 Nic,

Great post!

One potential issue with this approach is that the backup data is stored in the clear on the DS. It would be interesting to consider ways to encrypt the backup with keys known to the client only.

.. WebDAV with a TrueCrypt virtual disk .. Not sure what performance would be like.

Steve

]]>
By: Nic https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-7489 Mon, 09 Apr 2012 03:27:05 +0000 http://nicj.net/?p=1090#comment-7489 In reply to depannage informatique.

Hi Sebastien,

Yes, you should be able to simply enable rsync on the Synology and open the appropriate port on your firewall/router to forward it. This method uses the same thing, however, it encrypts the transmission over SSH.

]]>
By: depannage informatique https://nicj.net/backing-up-windows-computers-to-a-synology-nas-via-ssh-and-rsync/comment-page-1/#comment-7485 Sat, 07 Apr 2012 19:08:43 +0000 http://nicj.net/?p=1090#comment-7485 it is a bit hard for non experienced user to do this !

is it possible to save ours computers to a remote DS in another way ?

rsync, webdav ? or anything else ?

thanks for sharing !

Sebastien

]]>