Client | cygwin-rsyncd Reinstall

rsyncd quit running as a service.  I decided to reinstall it using the service.bat batch file.  Since rsyncd was already listed as a service, the install failed.  Therefore, you need to delete the rsyncd service using the following command:

  • c:\>sc delete rsyncd
  • Reboot the computer

After the reboot, run the service.bat file included in cygwin-rsyncd.zip download.

Reloading the Hosts File

# /mnt/vol1/backuppc/backuppc reload

Installation | init.d Script

Per the README located in the extraction directory /root/backuppc/BackupPC-2.1.2/init.d, I did the following:

RedHat Linux:
============

When configure.pl is run, the script linux-backuppc is created. It
should be copied to /etc/init.d/backuppc:

cp linux-backuppc /etc/init.d/backuppc

After copying it, you can test it by running these commands as root:

/etc/init.d/backuppc start
/etc/init.d/backuppc status
/etc/init.d/backuppc stop

You should then run the following commands as root:

chkconfig –add backuppc
chkconfig –level 345 backuppc on
chkconfig –list backuppc

This will auto-start backuppc at run levels 3, 4 and 5.

Client | cygwin-rsyncd

Install the cygwin-rsyncd on WinXX clients. I tried using SMB, but it didn’t work. rsyncd works better per the BackupPC FAQ.

Windows XP Firewall Issue
Make sure that the Windows XP firewall, if turned on, is allowing connections through on port 873 (rsync).

Edit rsync.conf on the workstation

[CAM]
#
# Exact DOS style path to the file or directory to be rsync accessible
#
path = e:/CAM

#
# A short description of the module. This is what is printed when
# using rsync to “browse” the server for what modules are available.
#
comment = CAM Data

Make sure that the [Module Name] matches this client’s config.pl $Conf{RsyncShareName}. Otherwise the backup will fail.

CGI Authentication | AuthUserFile

In the Apache http.conf file, the backuppc directory has included the AuthUserFile directive. This allows for user / password authentication to the BackupPC CGI application. In order to add a user for access, issue the following command as root in /var/www/cgi-bin:

htpasswd -c .backuppcpsswd username

You’ll be prompted for a password. This password is encrypted in the .backuppcpsswd file.

Installation | http.conf

Need to edit Apache http.conf located at /etc/httpd/conf

# The following was added for BackupPC, JCSUOMI 05/01/2006 @ 12:31PM

user backuppc
group backuppc
ServerName backup

<Directory /var/www/cgi-bin/>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
Order deny,allow
Deny from all
Allow from 172.16.0 127.0.0
AllowOverride Indexes AuthConfig
AuthName “Backup Admin”
AuthType Basic
AuthUserFile /var/www/cgi-bin/.backuppcpsswd
Require valid-user
</Directory>

Note: I had problems with an Apache error stating that ExecCGI wasn’t enabled. I found that I needed to search for “nested” options in the http.conf file. I # out the Options and the problem was resolved.

ScriptAlias /cgi-bin/ “/var/www/cgi-bin/”

#
# “/var/www/cgi-bin” should be changed to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory “/var/www/cgi-bin”>
AllowOverride None
# Disabled the following line for backuppc. JCSUOMI 05/01/2006
# Options None
Order allow,deny
Allow from all
</Directory>

Restart apache using the following command:

apachectl restart

Installation | config.pl

[root@backup BackupPC-2.1.2]# perl configure.pl

Is this a new installation or upgrade for BackupPC? If this is
an upgrade please tell me the full path of the existing BackupPC
configuration file (eg: /xxxx/conf/config.pl). Otherwise, just
hit return.

–> Full path to existing conf/config.pl []?

I found the following locations for these programs:

bzip2 => /usr/bin/bzip2
cat => /bin/cat
df => /bin/df
gtar/tar => /bin/gtar
gzip => /bin/gzip
hostname => /bin/hostname
nmblookup => /usr/bin/nmblookup
par2 =>
perl => /usr/bin/perl
ping => /bin/ping
rsync => /usr/bin/rsync
sendmail => /usr/sbin/sendmail
smbclient => /usr/bin/smbclient
split => /usr/bin/split
ssh/ssh2 => /usr/bin/ssh

–> Are these paths correct? [y]?

Please tell me the hostname of the machine that BackupPC will run on.

–> BackupPC will run on host [backup.cvx.com]?

BackupPC should run as a dedicated user with limited privileges. You
need to create a user. This user will need read/write permission on
the main data directory and read/execute permission on the install
directory (these directories will be setup shortly).

The primary group for this user should also be chosen carefully.
By default the install directories will have group write permission.
The data directories and files will have group read permission but
no other permission.

–> BackupPC should run as user [backuppc]?

Please specify an install directory for BackupPC. This is where the
BackupPC scripts, library and documentation will be installed.

–> Install directory (full path) []? /usr/backuppc

Please specify a data directory for BackupPC. This is where the
configuration files, LOG files and all the PC backups are stored.
This file system needs to be big enough to accommodate all the
PCs you expect to backup (eg: at least 1-2GB per machine).

–> Data directory (full path) []? /home/backuppc

BackupPC can compress pool files, providing around a 40% reduction in pool
size (your mileage may vary). Specify the compression level (0 turns
off compression, and 1 to 9 represent good/fastest to best/slowest).
The recommended values are 0 (off) or 3 (reasonable compression and speed).
Increasing the compression level to 5 will use around 20% more cpu time
and give perhaps 2-3% more compression.

–> Compression level [3]?

BackupPC has a powerful CGI perl interface that runs under Apache.
A single executable needs to be installed in a cgi-bin directory.
This executable needs to run as set-uid backuppc, or
it can be run under mod_perl with Apache running as user backuppc.

Leave this path empty if you don’t want to install the CGI interface.

–> CGI bin directory (full path) []? /var/www/cgi-bin

BackupPC’s CGI script needs to display various GIF images that
should be stored where Apache can serve them. They should be
placed somewher under Apache’s DocumentRoot. BackupPC also
needs to know the URL to access these images. Example:

Apache image directory: /usr/local/apache/htdocs/BackupPC
URL for image directory: /BackupPC

The URL for the image directory should start with a slash.

–> Apache image directory (full path) []? /var/www/icons
–> URL for image directory (omit http://host; starts with ‘/’ ;) []? /icons

Ok, we’re about to:

- install the binaries, lib and docs in /usr/backuppc,
- create the data directory /home/backuppc,
- create/update the config.pl file /home/backuppc/conf,
- optionally install the cgi-bin interface.

–> Do you want to continue? [y]?
Created /usr/backuppc/bin
Created /usr/backuppc/doc
Created /usr/backuppc/lib/BackupPC/CGI
Created /usr/backuppc/lib/BackupPC/Lang
Created /usr/backuppc/lib/BackupPC/Xfer
Created /usr/backuppc/lib/BackupPC/Zip
Created /var/www/html/backuppc
Created /home/backuppc/.
Created /home/backuppc/conf
Created /home/backuppc/pool
Created /home/backuppc/cpool
Created /home/backuppc/pc
Created /home/backuppc/trash
Created /home/backuppc/log
Installing binaries in /usr/backuppc/bin
Installing library in /usr/backuppc/lib
Installing images in /var/www/icons
Making init.d scripts
Installing docs in /usr/backuppc/doc
Installing config.pl and hosts in /home/backuppc/conf
PING backup.cvx.com (127.0.0.1) 56(84) bytes of data.
64 bytes from backup.cvx.com (127.0.0.1): icmp_seq=0 ttl=64 time=0.048 ms

— backup.cvx.com ping statistics —
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.048/0.048/0.048/0.000 ms, pipe 2
Installing cgi script BackupPC_Admin in /var/www/cgi-bin

Ok, it looks like we are finished. There are several more things you
will need to do:

- Browse through the config file, /home/backuppc/conf/config.pl,
and make sure all the settings are correct. In particular, you
will need to set the smb share password and user name, backup
policies and check the email message headers and bodies.

- Edit the list of hosts to backup in /home/backuppc/conf/hosts.

- Read the documentation in /usr/backuppc/doc/BackupPC.html.
Please pay special attention to the security section.

- Verify that the CGI script BackupPC_Admin runs correctly. You might
need to change the permissions or group ownership of BackupPC_Admin.

- BackupPC should be ready to start. Don’t forget to run it
as user backuppc! The installation also contains an
init.d/backuppc script that can be copied to /etc/init.d
so that BackupPC can auto-start on boot. This will also enable
administrative users to start the server from the CGI interface.
See init.d/README.

Enjoy!
[root@backup BackupPC-2.1.2]#

Client and Server Setup | New Win Workstation

Client Setup

Install the cygwin-rsyncd on the workstation.

Copy the config and secrets file from a working workstation.

Server Setup

Make a new directory to hold the backup files

mkdir /home/backuppc/pc/comp37

Copy the config.pl from a similar workstation

cp /home/backuppc/pc/comp50/config.pl /home/backuppc/pc/comp37/config.pl

Verify that the config.pl is correct for the new install. Pay attention to the module names in config.pl and the workstation config.

pico -w /home/backuppc/pc/comp37/config.pl

Change ownership of all files in the new directory

chown backuppc:backuppc /home/backuppc/pc/comp37 -R

Edit the hosts file to include the new workstation

pico -w /home/backuppc/conf/hosts

Reload the hosts file

# /mnt/vol1/backuppc/backuppc reload

Edit the backup include file for HD swapout and swapin

pico -w /home/config/backup.inc

Include the new workstation name + comp37

Client and Server Setup | Linux System | SSH Setup

Why Use SSH?

From BackupPC FAQ: SSH Setup

SSH is a secure way to run tar or rsync on a backup client to extract the data. SSH provides strong authentication and encryption of the network data.
Excerpts from Unable to read 4 bytes, backuppc-users email archive

Setting Up SSH for Rsync for Linux Clients

To use SSH you must create a certificate on the BackupPC Server and copy it to the Linux Client machine.

On the BackupPC Server

Create a login shell for the BACKUPPCUSER which in this case is backuppc. You will also have create a directory for the certificate:

Log in as root:

[root@backup ~]# mkdir /home/backuppc/.ssh

[root@backup ~]# chown backuppc:backuppc /home/backuppc/.ssh

Login as backuppc and create a certificate:

[root@backup ~]# su backuppc
bash-3.00$ pwd
/root
bash-3.00$ ssh-keygen -t rsa

Note: Accept the defaults, enter return for all questions – enter nothing for the pass phrase so the results are:
Generating public/private rsa key pair. Enter file in which to save the key (/home/backuppc/.ssh/id_rsa): Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/backuppc/.ssh/id_rsa.
Your public key has been saved in /home/backuppc/.ssh/id_rsa.pub.
The key fingerprint is:
95:c7:c1:68:52:a3:09:21:f9:31:e1:ae:39:bd:e8:42 backuppc@backup.cvx.com

As root, Copy the public key to the Linux system:

[root@backup ~]# scp /home/backuppc/.ssh/id_rsa.pub ibma21m.cvx.com:/root/.ssh/authorized_keys2

Note: If you get the error “No such files or directory”, then ssh into the client as root and create the directory /root/.ssh.

Now test the login as the user backuppc, eventually you should get just root with no password required:

[root@backup ~]# su backuppc
bash-3.00$ ssh -l root ibma21m whoami
The authenticity of host ‘ibma21m (172.16.0.45)’ can’t be established.
RSA key fingerprint is a6:b6:68:16:b6:65:b4:38:b2:bc:86:d6:5a:eb:71:07.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘ibma21m’ (RSA) to the list of known hosts.
root

Note: The client needs to be in the know hosts of the server or backuppc won’t connect. Therefore, the testing is mandatory!

BackupPC Software

Per their website

BackupPC is a high-performance, enterprise-grade system for backing up Linux and WinXX PCs and laptops to a server’s disk. BackupPC is highly configurable and easy to install and maintain.

Version 2.1.2 released on September 5th, 2005
2.1.2pl1 (patch level 1) released on Feb 8th, 2006