BackupPC

To Backup a Windows Computer:


Download Cygwin and install packages: openssh, openssl, unzip, zip, rsync

That should get you everything you need.


To configure SSH and test your Cygwin setup, follow these steps:

  1. After you install Cygwin, navigate to the C:\cygwin directory, open the Cygwin.bat file in edit mode using any editor, and add the following line before invoking the bash shell.

  2. set CYGWIN=binmode ntsec

For example, here are the contents for the Cygwin.bat file after adding the above line:

@echo off

C:

chdir C:\cygwin\bin

set CYGWIN=binmode ntsec

bash --login -i

  1. To verify if Cygwin (cygrunsrv) is installed properly, run C:\cygwin\Cygwin.bat, and execute the following command:

  2. cygrunsrv -h

  3. If Cygwin is installed properly, then all the Cygwin help options are displayed on the screen. However, if this command returns an error message, then you may have to reinstall Cygwin.


Now set up the SSHD service

  1. To configure the SSHD service, run C:\cygwin\Cygwin.bat, and execute the following command:

  2. ssh-host-config

  3. After running the command, you are prompted the following questions:

  4. *** Query: Should privilege separation be used? <yes/no>: yes

  5. *** Query: New local account 'sshd'? <yes/no>: yes

  6. *** Query: Do you want to install sshd as a service?

  7. *** Query: <Say "no" if it is already installed as a service> <yes/no>: yes

  8. *** Query: Enter the value of CYGWIN for the deamon: [] binmode ntsec

  9. *** Query: Do you want to use a different name? (yes/no) yes/no

  10. At this point, if you want to use the same name, that is cyg_server, enter no. You are then prompted the following questions:

  11. *** Query: Create new privileged user account 'cyg_server'? (yes/no) yes

  12. *** Query: Please enter the password:

  13. *** Query: Renter:

  14. However, if you want to use a different name, enter yes. You are then prompted the following questions:

  15. *** Query: Enter the new user name: cyg_server1

  16. *** Query: Reenter: cyg_server1

  17. *** Query: Create new privileged user account 'cyg_server1'? (yes/no) yes

  18. *** Query: Please enter the password:

  19. *** Query: Reenter:

  20. If the configuration is successful, you will see the following message:

  21. Host configuration finished. Have fun!

The SSH Service is installed. Run it. Check it. May have to open Firewall!


Create in the cygwin directory the following files with similar content:

rsyncd.conf

#

# A sample rsyncd.conf file usable with BackupPC. This file does not

# completely document all of the settings for rsyncd.conf - see the

# man page that comes with the rsync ditribution for a comprehensive

# overview off all available settings.

#


#

# Allow rsync to change the root directory to the module location

# upon connection of a client. This is disabled for Win32 as we do

# not provide a full Cygwin environment.

#

# Warning: with a setting of "false", absolute symlinks will be

# stripped of their leading "/". See "use chroot" in the rsyncd.conf

# man page. This is relevant for machines that support symlinks

# (WinXX machines do not).

#

use chroot = true


#

# Limit the simultaneous rsync connections to 4. Changing

# this to '1' should be sufficient for BackupPC.

#

max connections = 4


#

# Uncomment this line and change the path if

# you would like to log rsync messages.

#

# log file = c:/rsyncd/rsyncd.log


#

# The location of the rsync process ID file

#

pid file = c:/cygwin64/rsyncd.pid


#

# The locations of the rsync lock file

#

lock file = c:/cygwin64/rsyncd.lock


#

# This is where we define the rsyncd modules. Add as many directories or

# files are you wish. To backup this module using BackupPC, set

# $Conf{RsyncShareName} to "docs" in this client's config.pl.

#


Then make rsync a service.

C:\cygwin\bin\cygrunsrv.exe -I "rsync" -p /cygdrive/c/cygwin/bin/rsync.exe -a "--config=/cygdrive/c/cygwin/etc/rsyncd.conf --daemon --no-detach" -f "Rsync daemon service"


Mount backup drive

On the backuppc server, if you are using a separate HD for the backups, then you need to mount /var/lib/backuppc to it.

First make sure your backup location is using reiserfs

mkfs -t reiserfs /dev/sdb1

Then let's mount this to a temp location.

mount /dev/sdb1 /mnt

Then copy everything from the backuppc directory

cp -rp /var/lib/backuppc /mnt

Now we unmount it from it's temp location. Rename the old backuppc folder for now to backuppc.old. Make a new backuppc folder and let's mount sdb1 to it.

If all is good edit /etc/fstab to read:

/dev/sdb1 /var/lib/backuppc reiserfs defaults 0 2


To install rsync service:

First we need to enable passwordless ssh.

su to the user account backuppc and ssh to the Windows computer using the necessary username.

On the computer you'll be ssh-ing from generate ssh keys:

cd ~/.ssh

chmod 700 ~/.ssh

ssh-keygen -t rsa

(no password)

Then from same computer transfer the keys to the client:

ssh-copy-id <username>@<host>


Now, test by issuing the following command:

rsync --list-only [SERVER]:/home/