Slashdot Mirror


Remote Backup of Windows Boxes w/o Samba?

reezle asks: "I'm looking for a good (free as in beer) method to have my Debian server back up some remote Windows machines. There is no Samba in the mix; this is supposed to be a strictly secure internet thing. I've been toying with OpenSSH on the windows computers as a good tunnel, thought of simple tools like ntbackup initiated from a script on the Linux box, but not all of the pieces have come together yet. I need to have the Linux box make the connection, back up data (full and incremental backups) and have that backup data get back to the Linux machine in an encrypted format (across the wild internet). Has anyone done something like this?"

30 of 100 comments (clear)

  1. Idea, by MoOsEb0y · · Score: 3, Interesting

    Install an SSH Server on the windows machine, use SHFS to mount the remote filesystem to a directory, then use rsync to copy it.

    1. Re:Idea, by nocomment · · Score: 3, Interesting

      I do this on my linux boxes and it works really well. A quick google talks about people doing this between *nix and windows.

      --
      /* oops I accidentally made a comment, sorry */
      /* http://allyourbasearebelongto.us */
  2. Three letters: SCP. by GregChant · · Score: 4, Interesting

    Your best bet, in a cheap and dirty solution, is to use SCP. Set up a cron job to securely copy the files you need. No muss, no fuss, no samba, and all encrypted.

    1. Re:Three letters: SCP. by cookd · · Score: 3, Informative

      If you are copying 400 GB, you'll use 400 GB of bandwidth (less with compression, perhaps 200GB) each time you back up, whether or not anything has actually changed. That's very bad.

      The advantage of stuff like rsync is that it only sends the deltas over the network. I have a daily backup of my 400 GB over the net. If nothing changes, it only uses 100k of bandwidth.

      --
      Time flies like an arrow. Fruit flies like a banana.
    2. Re:Three letters: SCP. by Drakon · · Score: 2, Informative

      WinRAR can create archives of files that were modified after a certain timestamp

    3. Re:Three letters: SCP. by Zocalo · · Score: 2, Informative
      Nope, you didn't miss anything as SCP has no incremental option. You could work around that by using a data compression tool to create an archive of just the files that have been changed, then SCPing that and uncompressing over the data mirror on the remote server. That doesn't help much if part of your data set is a big database file of which only a couple of records have changed though.

      A far more efficient method would be to look at using RSYNC with SSH as a few others have pointed out. There's a pretty good HOWTO for Windows here, which avoids the overhead of a full Cygwin install. You'll probably want to check out the link to cwRSYNC at the top of that page too.

      --
      UNIX? They're not even circumcised! Savages!
  3. Backup by m0rph3us0 · · Score: 3, Interesting

    Use the windows backup program to have windows make the backups then have Windows copy them to the debian box via scp.

    Or.... put Samba on the Debian box, use port forwarding and the loopback adapter to create a tunnel to the samba box and have the windows backup program write to the samba share which is only listens on 127.0.1.1

    setup on windows box:
    Loopback IP: 172.168.254.1
    Real IP: XX.XX.XX.XX
    SSH port forward from Local 172.168.254.1:139 to remote 127.0.0.1:139

    Create an account for each machine on the debian box.

    Windows backs up to \\172.168.254.1\MACHINENAME

  4. Might give Unison a Try by namtro · · Score: 5, Interesting

    I've had fairly good experiences with the Unison product. It works similarly to rsync but with a few enhanced features. And I quote...

    • Unison runs on both Windows (95, 98, NT, and 2k) and Unix (Solaris, Linux, etc.) systems. Moreover, Unison works across platforms, allowing you to synchronize a Windows laptop with a Unix server, for example.
    • Unlike a distributed filesystem, Unison is a user-level program: there is no need to hack (or own!) the kernel, or to have superuser privileges on either host.
    • Unlike simple mirroring or backup utilities, Unison can deal with updates to both replicas of a distributed directory structure. Updates that do not conflict are propagated automatically. Conflicting updates are detected and displayed.
    • Unison works between any pair of machines connected to the internet, communicating over either a direct socket link or tunneling over an rsh or an encrypted ssh connection. It is careful with network bandwidth, and runs well over slow links such as PPP connections. Transfers of small updates to large files are optimized using a compression protocol similar to rsync.
    • Unison has a clear and precise specification.
    • Unison is resilient to failure. It is careful to leave the replicas and its own private structures in a sensible state at all times, even in case of abnormal termination or communication failures.
    • Unison is free; full source code is available under the GNU Public License.

    Anyway, you might give it a look...

    1. Re:Might give Unison a Try by FrenZon · · Score: 2, Informative
      I've had fairly good experiences with the Unison product.

      I am a huge fan of Unison, and I use it to sync all files, bookmarks and settings between my windows laptops and desktops. But it is NOT a backup utility - if you have it set to run at set intervals, and one set of files becomes corrupted, deleted or otherwise changed, Unison will then do the same to all the other files. It does not have rollback.

      It's handy for total machine or disk failures, but not so handy if, say, a virus trashes your files and you don't realise until after you've synced those files with everywhere else, or for work situations where someone deleted the wrong directory, renamed the files incorrectly etc etc.

    2. Re:Might give Unison a Try by cookd · · Score: 3, Informative

      You're taking it out of context, or maybe misunderstanding the feature. Some backup systems require OS support, so you have to install something setuid, set up a service, or hack the kernel to even get it to work. The idea is that this runs as a user (as do other programs like rsync or scp) and not as a kernel component (like a filesystem driver).

      Your interpretation: This program magically allows any user to read any file on the system without admin privileges.

      Correct interpretation: This program does not require admin privileges to install or run, and can run as any user. (Of course, the files that the program can access are limited by the user it runs as.)

      --
      Time flies like an arrow. Fruit flies like a banana.
    3. Re:Might give Unison a Try by Vlad_Drak · · Score: 2, Informative

      You would clearly want to have LVM (or some other) snapshotting enabled on the destination Linux host's volume. If you did want to export the snapshots for user restoration, you could then share out the point in time (12hr, yesterday, DOW, M,..) as well.

      Rsync with cygwin would be another option, my experience with OpenSSH/scp on Windows has been poor when it's under pressure.

      -Chris

    4. Re:Might give Unison a Try by Sarunas · · Score: 2, Informative

      that's incorrect. you can have it keep multiple copies\revisions of your backups.

  5. A few solutions by moosesocks · · Score: 3, Informative

    As mentioned earlier here, there are numerous SSH/SCP implementations for Win32. Search around. They're somewhat hard to find, but there's quite a few (make sure you choose one in active development. There are quite a few abandoned projects with security holes and other bugs). Honestly, I don't remember what one I use on my windows machine :) As a word of advice, do not use a cygwin distribution. They're somewhat buggy and need to run inside cygwin. The 'native' servers which link against some cygwin libraries seem to be allright though.

    There's also another easier option. But, it will cost you. Use a "real" backup program such as Retrospect which will do compression and encryption (very strong encryption if you desire) client side. More often then not, this is what big businesses use. You can then safely use smb, ftp, scp, whatever you wish

    --
    -- If you try to fail and succeed, which have you done? - Uli's moose
    1. Re:A few solutions by zatz · · Score: 2, Informative

      Cygwin has it's shortcomings, but I use it for exactly this task and it works well. Some tips for new Cygwin users:

      You will need to run ssh-host-config after you install the ssh package. Under Windows Server 2003, it apparently can't setuid properly unless an actual password is supplied, so change the service to run as the user, instead of local system.

      Cygwin is sometimes a little slower than you might expect, especially for I/O, due to the extra layers of indirection. One huge performance problem is that stat() reads the first block of every file. Non-blocking network I/O is also a little iffy; you may have to fiddle with the options to rsync to get things working in both directions.

      Don't expect it to preserve NTFS ACLs. It does a decent job of simulating Unix-style file permissions, though. I think it uses the Posix subsystem for some file operations, because you can do strange things like create a file named NUL (which you then won't be able to remove within Windows).

      In very rare circumstances, the games Cygwin plays with the filesystem interface will break rsync entirely. For example, if you have a file named SETUP.EXE, rsync will copy it fine. If you later create a directory named SETUP in the same place, rsync will get confused, because it will stat SETUP on the destination and see the file.

      The Cygwin terminal is hopelessly non-standard. The supplied terminfo mostly works, but not entirely. This might be fixable, but I haven't tried very hard.

      --

      Java: the COBOL of the new millenium.
  6. netcat by bergeron76 · · Score: 3, Informative

    Use netcat (nc)

    A version exists for Windows (it's what the kiddee's use), but it can be used for legit purposes if done properly.

    --
    Don't think that a small group of dedicated individuals can't change the world. It's the only thing that ever has.
  7. rsync by DDumitru · · Score: 2, Informative

    You can push the data using rsync. Load the Windows / cygwin version of rsync/ssh on the windows box. Then sync the whole box up to a debian directory over ssh. If you get fancy you can build rotation sets, etc. rsync is very efficient at moving only what changes, handling include/exclude lists, etc. Great for backing up lots of data.

    Do a google search on "rsync windows backup".

    The only downside is that rync will "kill" your upstream internet connection (it is that efficient). Fortunately, there is a --bwlimit option so you can back off a little.

    If you are looking for a commercial hoster with all of the scripts pre-built we are happy to help (sorry for the AD), but it is pretty easy to roll this yourself.

  8. Re:Cygwin + rsync by Filoseta · · Score: 2, Interesting

    To expand on this slightly, I have had good success with duplicity.

    It supports gpg signing and encrypting of archives and provides direct support for scp/ssh as a transport while handling full and incremental backups very nicely (well, after I wrote a few wrapper scripts just to make my life easier).

    I have not used it on windows with cygwin, but I know people who are.

  9. Re:Cygwin + rsync by cookd · · Score: 2, Informative

    Cygwin is not secure for daemons -- if user A is running a Cygwin program, you should assume that any user on the system can execute code as user A. This is due to the global shared memory that Cygwin uses to keep track of things -- it is accessible to all users and is assumed to be safe.

    If you're going to use rsync, use Interix/SFU. That's what I currently use, though I might switch to Unison. Works great, though sometimes the permissions are a pain (the Posix permissions don't always translate nicely to Windows ACLs)...

    --
    Time flies like an arrow. Fruit flies like a banana.
  10. Bacula by DeathBunny · · Score: 3, Informative
    Use Bacula. It's a GPL'd client/server enterprise backup software. It includes clients for most versions of Unix, OSX, and Windows.


    Although the clients do not have built in support for encryption, according to the manual you can run the clients through stunnel to encrypt the traffic between the clients and the backup server. Future versions are supposed to support encryption built into the client.

    1. Re:Bacula by GLHMarmot · · Score: 2, Interesting
      I use bacula extensively between various flavours of linux and windows. It just works. You can set your retention period and it will automatically purge old information. It will write to various backup media (tape, disk etc) and create volume sizes of your choice.

      I use OpenVpn for encrypted connectivity between the machines as I am backing up a number of them across the net. It also has linux and windows clients.

      One caveat is that I don't use it to backup the entire system. I back up the users' data and configuration information as the rest can be easily restored from the original media.

  11. cygwin, bleh by kayen_telva · · Score: 2, Informative

    you dont need cygwin. putty on the windows machine can create a tunnel to your debian machine. do what you like from there

  12. A solution: Acronis TrueImage by Futurepower(R) · · Score: 2, Informative


    NTBackup that comes with Windows can NOT backup all the Windows system drive, only part of it. Windows XP and 2000 (not Windows 98) have crippled file systems, apparently to implement copy protection.

    NTBackup presumes that you are a peon whose time is worth nothing, and you don't mind loading all of your programs again. Some people restore a backup over a working Windows XP installation, but this is said by Microsoft technical support people to be unstable.

    The ONLY way to back up a Windows XP and 2000 system drive is to do a sector by sector copy. See my Slashdot story and a discussion of this: Experiences w/ Drive Imaging Software?. The story gives a method of copying under Linux.

    However, most sector by sector copies require that you have complete control over the drive.

    The only solution I've found is Acronis TrueImage. It costs $50, and it works, although there are some small flakinesses. You can backup a Windows XP or 2000 system drive while Windows is running and being used. You can send the backup over a network to a local Linux machine.

    To send the backups over the Internet, you would encrypt the Acronis files with GNU Privacy Guard first. There is a way to submit the password to GPG in a batch file. Since anyone who has access to the password has access to the backup files, this is not a security risk.

    Google has more links to GPG.

    I'm interested in hearing about any experiences anyone has with this.

    Microsoft enthusiasts: Please don't disagree with the facts here, they have been verified many times by Microsoft articles and technical support people. Specifically, the NTFS file system is crippled, and NTBackup cannot back up the working system partition.

  13. Look at rdiff-backup by cornice · · Score: 2, Interesting

    Take a look at rdiff-backup. I've been very impressed with it. From the website:

    rdiff-backup backs up one directory to another, possibly over a network. The target directory ends up a copy of the source directory, but extra reverse diffs are stored in a special subdirectory of that target directory, so you can still recover files lost some time ago. The idea is to combine the best features of a mirror and an incremental backup. rdiff-backup also preserves subdirectories, hard links, dev files, permissions, uid/gid ownership, and modification times. Also, rdiff-backup can operate in a bandwidth efficient manner over a pipe, like rsync. Thus you can use rdiff-backup and ssh to securely back a hard drive up to a remote location, and only the differences will be transmitted. Finally, rdiff-backup is easy to use and settings have sensical defaults.


    I found it to be very fast and reliable. And yes, it aparently does work under Windows.

  14. Arkeia! by GoRK · · Score: 2, Insightful

    Well since you said free as in beer not free as in libre, and since you did not say how many machines you needed to back up exactly, I might as well suggest to you that you try Arkeia. The free version, "Arkeia Light," supports a server with a single tape drive (no changer robots) and up to 2 client machines. So you can use it to back up 3 machines -- If you use more than that or if you have a tape library, you gotta cough up for a license.

    Plenty of the solutions people have posted about are fine and dandy hack jobs and while they probably will work -- they would take a lot of time and effort to implement. Arkeia is pretty easy to install on the client end - you basically just install the client and tell it the name of the server - the acutal backup is managed completely by the server. Clients are available for practically every OS under the sun.

    Arkeia has served me pretty well over the last few years, so even with the cost (not very much for a comparable solution from any other vendor) you really do get a pretty decent product.

  15. rsync over ssh (cygwin) by dimss · · Score: 2, Informative

    We use cygwin rsync+ssh as for backup purposes and data exchange between remote offices. This is the best solution we've found so far. Each office runs rsync every minute. Data is transferred via Linux server.

    There are drawbacks too. For example, you cannot store SSH key on mapped network drive. And do not use it with Windows 98, bash script and rsync will hang after 1-2 hours.

  16. dual boot to linux by kyuso · · Score: 2, Interesting

    I dual-boot to linux in all the Windows PC (Every PC has linux boot) then use ssh/rsync to backup the whole Windows directory. Of course all windows partition must be FAT32 (even for WinXP) or something read/writable by linux. Then ssh reboot to Windows.

    Nothing fancy to do on Windows. It takes 10 to 30 minutes to restore Windows to the way it was exactly when it was backed up, including XP. Without linux, it would have taken a whole day with all the patches, drivers, exact configuration, applications install, more patches, etc. etc.

  17. BackupPC by mrph · · Score: 3, Insightful
    I use BackupPC on a Debian box to backup some laptops and a server at work.
    It is highly configurable and easy to set up automatic backup routines and you can monitor operations
    using a webbased interface. BackupPC also supports various transfer methods such as rsync, samba, etc.
    and makes use of compression and pooling of files to save diskspace.

    Of course, getting some scripts using rsync over ssh or something like that won't be that hard,
    but anyway, I recommend you to check out BackupPC.

  18. Quick and Dirty Secure Win-Lin backup by Proteus · · Score: 2, Interesting
    I've got a quick-and-dirty solution that I use for off-site backups of a relative's Windows network. This may not be exactly what you need, but hopefully it gets you started in the right direction.

    First, I create backup files. To do this, I use the Backup utility built into Windows (for better or worse). Of course, this assumes you have enough freespace on your Windows volumes to accomodate the backups...

    On the server side, I set up an FTP daemon and an OpenSSH daemon. The FTP daemon is configured to only accept connections from localhost, so one must log in via SSH to transfer via FTP.

    Then, I use a simple Win script to
    1. open a key-authenticated SSH session with PuTTY (configured to tunnel FTP connections)
    2. establish an FTP connection with localhost on the Win machine (initiates tunnelled connection)
    3. transfer the files with FTP over the secure link

    This has worked fantastically well for me, and the only thing I didn't already have was PuTTY. It's also as secure as any other SSH activity (pretty darn secure), and if you make the SSH session log in as a restricted "backup" user, it becomes very difficult to use this system to escalate privileges on the server.
    --
    We may not imagine how our lives could be more frustrating and complex—but Congress can. – Cullen Hightower
  19. Yes, I've done this. by millisa · · Score: 2, Informative

    I've put something similar in place which utilized the built in NTBackup as well as a combination of SSH/FTP. Scripting out NTBackup is easy enough; you just create the BKS file it'll use, backup using that file, and then get the file over to your linux system.

    To backup the systemstate (you need to do this on your DC's and Exchange boxes), you have to do it locally.

    Instead of putting in a directory in your BKS, just put the word: SystemState
    on its own line.

    Your exchange directory store:
    DS \\EXCHANGESERVERNAME

    You exchange information store:
    IS \\EXCHANGESERVERNAME

    Directories and files:
    c:\whereever\blah\blah\blah
    c:\anotherdir \blah

    To exclude:
    add a /exclude to the dir/file line in the BKS.

    Note: The BKS files are in a sort of unicode format (thanks Microsoft). I was using perl to create the files before every backup so I didn't have to depend on changing static files on each system being backed up. Its not quite unicode . . . open the file in a hex editor and check it out if you want to write them dynamically.

    To kick off ntbackup at the commandline and use that BKS, something like this would work:

    ntbackup backup "@\\server\backupdir\YOURSERVER_SystemState.bks" /j "Helpful Description SystemState" /f \\server\backupdir\name_of_your_backup.bkf /n "Helpful Description SystemState" /d "Helpful Description SystemState" /v:no /r:no /l:s /m normal /rs:no /hc:off

    Or for an incremental:
    ntbackup backup "@\\server\backupdir\YOURSERVER_bunchadirs.bks" /j "Helpful Description BunchaDirs" /f \\server\backupdir\name_of_your_backup.bkf /n "Helpful Description BunchaDirs" /d "Helpful Description BunchaDirs" /v:no /r:no /l:s /a /m incremental /rs:no /hc:off

    I was planning on exclusively using SCP to transfer the files between the systems, but I ran into problems with the Win32 SSH client and server. Anytime I wanted to move a file bigger than 2G off the Win systems, I'd end up with a corrupt file. (So, I had to resort to using FTP in some cases).

    Only semi related, If you are backing up systems at a datacenter and eventually sending them to a repository in the office (or vice versa) and sending them over a limited data line (we only had a couple T1's), you might want to look at the shaper app. I was able to limit the traffic heading over that T1 line after it was conglomerated on a datacenter server so that the users in the office could still do their work.

    After adding a few hooks to the various scripts to have it spew its progress to a central server that I monitor for errors, I had a fairly scalable script based backup system using built in backups (NTBackup on 2k/Xp/2k3 and Tar). Oh, and Bzip2 is your friend on the windows systems. Getting around 2GB file size limitations was the biggest pain in the whole setup. Go through some good QA and check every backup that is created for the first week; it sucks finding out your files are corrupted when you need them . . .

  20. Why not just... by Gudlyf · · Score: 2, Informative
    Why not just install the ssh server and rsync (via Cygwin), then:

    rsync -avz -e ssh winbox:/cygdrive/c/ /path/to/backup

    Or one thing I use, to keep incremental backups, is rdiff-backup.

    --
    Trolls lurk everywhere. Mod them down.