Backup Remote Windows to Linux Via Tunnel

What do you have and what do you want?

Moderators: b1o, jkerr82508

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Backup Remote Windows to Linux Via Tunnel

Postby Snorkasaurus » 05 Aug 2014, 04:23

Hey Zerkers,

I have a Debian box (running LXDE) that I wish to use as a backup server, which will automatically connect to my remote Windows box and back up a number of directories each night. I do not need to run any commands remotely, just pull down any new/changed files and delete any files that have been removed from the remote server... yes, just a basic sync. The remote Windows box runs FreeSSHd and has in the past been backed up by a WinSCP script (automated by "Scheduled Tasks").

I have tried rsync (and looked at the uber-backup-tool thread here) but it has two problems with my setup. One is that it does not like the fact that I run FreeSSHd on a non-standard port and the other is that it does not like the way FreeSSHd presents it's CLI. I was mostly able to work around the first one with some nifty CLI-fu arguments on rsync, but I simply can't get it to accept that FreeSSHd is a real SSH connection. The error message I am getting is

Code: Select all

protocol version mismatch -- is your shell clean?
Startpage'ing this message gets me plenty of results, none of which seem to have any answers on how to fix it.
So I am looking for advice to repair this on either end.

Option 1: Replace FreeSSHd on my Windows box.
I am open to the idea of replacing FreeSSHd but the solution would have to be pretty stellar. FreeSSHd is small, has no dependencies, allows the creation of its own user accounts (not forcing me to create extra Windows accounts), integrates as a service, allows a non-standard port, etc. What I won't consider is: .NET, Java, VisualAnything runtime files, Perl, Python, Cygwin or any other application that has to be installed first. I am not optimistic that anyone here will be jumping on this idea anyways. :-)

Option 2: Replace rsync on my Debian box.
I imagine this is more likely to be possible but I still don't want a Gig of software to do backups, and the fewer the dependencies the better. Being in the Deb repos would be nice but not a necessity, and I don't care if it is CLI or GUI.

Ultimately what I am looking at is a night of screwing around with a few solutions, and my Debian install has already bloated to more than 4Gigs of diskspace which is completely ridiculous since the solution I am trying to avoid is installing 1.2Gigs of XP and going back to the way things were.

PS: Before anyone mentions the lack of security in running non-standard ports... if you can find another way to make my "attempted SSH hacks" go from "hundreds per month" to "zero per month" with absolutely zero difference in required diskspace, memory, and CPU cycles I am all ears. LAWL

Sorry guys, it has been along night,
S.

User avatar
viking60
Über-Berserk
Posts: 9302
Joined: 14 Mar 2010, 16:34

Re: Backup Remote Windows to Linux Via Tunnel

Postby viking60 » 05 Aug 2014, 22:06

Using different ports with ssh is possible

In the Berserk backup it should be enough to put your port in viking.backup like this:

Code: Select all

-p 2222 /home/snork


This will be read by $i in the script.

Code: Select all

rsync -azrv --delete --delete-excluded --exclude-from 'ex.txt' $i [email protected]:/media/LaCie/snork_backup/


In SCP the port is specified with a capital p: -P and comes first. Maybe that can help :confused
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Backup Remote Windows to Linux Via Tunnel

Postby Snorkasaurus » 05 Aug 2014, 22:28

Hey v60... I was eventually able to get that part of it (the non-standard port) working, the bomb is when rsync halts immediately after that and barfs up the protocol mismatch error. I found a number of people with a similar error message but it was related to a login script that was presenting extra information before the command prompt. I figured out that I can start a Windows based command environment with "/k" to suppress the copyright notice and go straight to a prompt but rsync doesn't like the "c:\" prompt. :-(

S.

User avatar
viking60
Über-Berserk
Posts: 9302
Joined: 14 Mar 2010, 16:34

Re: Backup Remote Windows to Linux Via Tunnel

Postby viking60 » 05 Aug 2014, 22:40

Ok I'll have a look at the software.
Edit:
I take it that you are running freesshd as a service? (I have no problem in using it for logging in on my other boxes from cmd).
And you are using winSCP for syncing - ok thinking.... :think:

Checking out Qdtsync....
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Backup Remote Windows to Linux Via Tunnel

Postby Snorkasaurus » 05 Aug 2014, 23:37

Yeppers... FreeSSHd as a service, on a non-standard port, one user account with key authentication (password auth disabled) and SFTP home setting at "C:\". I can log in with KiTTY (PuTTY fork) and use a CLI effectively and I can get WinSCP to backup (sync) about a dozen different directories via a script. I really just want to replace WinSCP with rsync or something else.
S.

User avatar
viking60
Über-Berserk
Posts: 9302
Joined: 14 Mar 2010, 16:34

Re: Backup Remote Windows to Linux Via Tunnel

Postby viking60 » 05 Aug 2014, 23:58

Hm looks lie cwRsync could do the job :think:
:A
https://www.itefix.net/cwrsync

cwRsync Free Edition contains a barebone distribution of Rsync for Windows. Unzip archive contents to a directory and update the supplied batch file cwrsync.cmd. That's all you need to be able to initiate rsync from your computer.


Edit:
Yes that seems to be the one that can make our backup work:

I downloaded it and unpacked the files to c:\gwrsync
There made the viking.backup file and put

Code: Select all

C:\Documents and Settings\thomas\Mine dokumenter\

in it
Then I made ex.txt and added the files to exclude:

Code: Select all

C:\Documents and Settings\thomas\Mine dokumenter\somecrap.txt

As you can see my documents and settings are not in English...
All in the c:\gwrsync folder.

Then I ran:

Code: Select all

rsync -azrv --delete --delete-excluded  --exclude-from 'ex.txt'  $i [email protected]:/media/LaCie/viking60-server_backup/


That seemed to work - but I could not run through it because I did it in a VB with a conflicting network name so the ssh part was protesting (But it did start and prompted me nicely for the password etc)
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Backup Remote Windows to Linux Via Tunnel

Postby Snorkasaurus » 06 Aug 2014, 00:21

Hey viking60,

Ohhh that's for Windows... I was hoping for a Linux based app, I totally should have explained a little better. I have a Windows based machine right now that I am replacing and was thinking that I might be able to do it with Linux. Here are the different services that machine provides and my ideas for them:

- Backup MX: I really don't think I'll find a Linux based mail server app I like so I am just dropping my backup MX and having mail delivered directly to my main mail server. It isn't a great solution but some recent firewall improvements might make it bearable.

- Asterisk: I will move this to my Debian router. I have very basic entirely manual Asterisk configs and do not need fancy new features that come with newer versions. Having it on my router will also give me better SBC VoIP positioning.

- Samba Shares: Already setup and easy to manage.

- Apache/PHP/MySQL: Easy stuff, all very standard

- Torrents: I think I am going to go with Transmission on this one, it has a small footprint, runs stable, has appropriate speed limit settings, and remote control.

- Backups: This one is my trouble maker. The old Windows box was quite successful with WinSCP, and the WinSCP home page even says that it should work fine under Wine, but it was a bomb. I definitely don't want to install hundreds of Megs (or Gigs) of software to do backups, especially since I need no incrementals, no differentials, just a straight sync. To be honest, rsync would probably work pretty well if it didn't require a Linux CLI rather than a Windows CLI.

Hopefully that'll give you a better idea of where I am coming from with this request. :-)
S.

User avatar
viking60
Über-Berserk
Posts: 9302
Joined: 14 Mar 2010, 16:34

Re: Backup Remote Windows to Linux Via Tunnel

Postby viking60 » 06 Aug 2014, 00:25

I have edited above; gwrsync will provide the Linux terminal functionality that you need.
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Backup Remote Windows to Linux Via Tunnel

Postby Snorkasaurus » 06 Aug 2014, 00:49

Hmm, I seem to be missing something. When I check out that link I see that the free version of the software is just the Windows client. The server side seems to be available for $35, but that doesn't sound like something I would do.

Just to make sure, here is what I am hoping for: Every night, while I am sleeping, my Linux box will automatically connect to my remote Windows box and sync a dozen or so directories (from the Windows box to the Linux box to be precise). Is cwRsync supposed to replace rsync on the Linux box or FreeSSHd on the Windows box?

S.

User avatar
viking60
Über-Berserk
Posts: 9302
Joined: 14 Mar 2010, 16:34

Re: Backup Remote Windows to Linux Via Tunnel

Postby viking60 » 06 Aug 2014, 02:45

It is supposed to provide rsync capability to your Windows box; you will still be needing Freesshd in addition to it.
The Windows box cannot passively take commands from a Linux box simply by wanting it :mrgreen:
You can now make the Windows box send the backup to the Linux box that has that USB disk attached to it (Or directly to its HD). That is what the free client can do. You don't need to spend a dime.

It is based on cygwin which can add Linux terminal functionality to your Windows cmd.
In this case rsync functionality is added. You can type the rsync command in the folder where you unpacked the files.

The Berserk backup is based on sending backups to the server. The server does not command the backups to be sent and does not select what has to be backed up. That is done on the client side..

If you want to make it automatically on a regular basis you might be able to find some macro program that can do it.

On the Linux side you will need the running SSH server (OpenSSH).
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"

User avatar
Snorkasaurus
Berserk
Posts: 587
Joined: 30 Dec 2013, 19:19
Contact:

Re: Backup Remote Windows to Linux Via Tunnel

Postby Snorkasaurus » 06 Aug 2014, 03:18

Hmmm, I'm looking for the opposite direction. I can't connect out from the server (to my backup location) since my backup location is on a dynamic IP. Actually, if I were willing to get a static IP for the backup location I could use WinSCP with only minor modifications to the current scripts. I have actually seen a lot of script examples that do push backups instead of pull backups, but it seems strange to me since my assumption has always been that CPU cycles and memory usage are much more valuable on the live server than the backup box (even if it is just a few of them).

Typically I would also not consider Cygwin but in this case it really is just included DLL support. I have seen some instances where it seems that Cygwin (the simple DLL) and then some extra supporting framework needs to be present first, and then the Cygwin dependent app can be added.

S.

User avatar
viking60
Über-Berserk
Posts: 9302
Joined: 14 Mar 2010, 16:34

Re: Backup Remote Windows to Linux Via Tunnel

Postby viking60 » 06 Aug 2014, 03:42

Well now I am confused. I assumed a (home) network
You want to back up your Windows box to your Linux box - which one of them has a dynamic IP?
From the header I take it that the Windows box has the dynamic IP ("Remote Windows").

In that case the Linux box who should receive the backup could do with a server name from no-ip.com so that you can address it by name.

Maybe this can be helpful too:
:A
viewtopic.php?f=11&t=1965
Manjaro 64bit on the main box -Intel(R) Core(TM) i7 CPU 920 @ 2.67GHz and nVidia Corporation GT200b [GeForce GTX 275] (rev a1. + Centos on the server - Arch on the laptop.
"There are no stupid questions - Only stupid answers!"


Return to “Software”