README for backup.pl (v 1.6 29/6/2007)
----------------------------
backup.pl (c) 2003-2007 th(at)bogus.net is a small utility that uses rsync to
make backup copies securely over the network.
preparation
===========
in order to make it work, you will need to install rsync on the machines you
wish to make backups of.
you can find rsync at http://samba.anu.edu.au/rsync/.
you also need ssh installed, and you will also need to enable passphrase-less
dsa (or rsa) authentication. to do this, you should ideally familiarise
yourself with ssh-keygen(1):
man ssh-keygen
but here is a quick start tutorial in order to get you started. first, on
the machine where you wish to keep your backups, run:
su -
ssh-keygen -t dsa
when you are prompted for a password, press return ("enter"). after the key
has been generated, it will be located in (usually) /root/.ssh/id_dsa.pub. copy
this key to every host's "root" authorized_keys file, e.g. do:
echo "ssh-dss AA.[truncated].o6Q== user@localhost.localdomain" >> /root/.ssh/authorized_keys
on all the hosts you wish to make backups.
if you plan to backup windows files
===================================
you will need to install Cygwin (which is a really easy affair), and
make sure you include sshd and rsync in the install dialogue.
when this is installed, you will need to generate the sshd host keys by
typing:
ssh-host-config
and you will also need to create your ssh keys, etc. you'd be smart to
create a "backup" user.
configuring
===========
the default path for the configuration file is /etc/backup.conf; you will
have to edit the backup.pl file if you wish to change this.
the configuration file is constructed as follows. all lines starting with
# or ; (including any white space preceding these characters) are
considered comments. the variable DESTROOT can be used to change the default
destination root directory for all the hosts you wish to backup. currently,
the destination root is "/export/backup".
it is also possible to have per-host DESTROOT's, as long as DESTROOT is
defined within the host definition block (see example configuration file).
backups will be organised under this directory so:
/export/backup
|
+---------+---------+--- .. ---+
| | | |
host1 host2 host3 user@hostN
any file/directory you do NOT want to include in the backup should be preceded
by - and whitespace, e.g.
/home
- /home/mrbig
will backup everything in /home, but not mrbig's directory.
you organise hosts in the configuration file using the following structure;
www.bogus.net {
/etc
/var/www
/home
- /home/ftp
}
ftp.bogus.net {
/etc
/local
- /local/src
- /local/obj
/home
- /home/ftp
}
me@myuniversity.edu {
/home/me
}
if the host portion of the configuration block is 'localhost', this will
instruct the script to send the files _to_ a remote server - ensure your
DESTDIR reflects this, e.g.:
localhost 512 {
DESTDIR=www.example.com:/local/myremotebackup
/etc
/home
}
the above will bandwidth limit a backup _from_ the local machine to a
remote server.
see the backup.conf file supplied for some more examples.
special note for windows boxes
==============================
any file that recides on a windows box can be backed up so:
backup@windows.host.here {
/cygdrive/c/My Documents
/cygdrive/c/Documents and Settings/myuser
}
running
=======
after you have decided what is necessary to keep a backup of, test it by
running backup.pl with no arguments. after the program has finished running,
verify that your files have been transferred, and then (e.g.) add the
following to your /etc/daily.local (or similar!):
if [ -x /usr/local/bin/backup.pl ]; then
echo "running backup.pl"; /usr/local/bin/backup.pl&
fi
enjoy!
a word or two on restore
========================
(this is completely left up as an exercise to the unfortunate user!)