[oclug]scp to backup?
Robert Brockway
robert at timetraveller.org
Thu Nov 7 07:20:03 EST 2002
On 6 Nov 2002, Raj wrote:
> You can tunnel rsync over ssh, thus getting the same security as
> (keyless) ssh and the speed of rsync.
Actually you can use keys. As long as there is a null (empty) passphrase
you can ssh/scp without user interaction. Disable password access to ssh
whenever possible. Using ssh with a null passphrase is considered better
security than passwords, but worse than using a passphrase (of course).
I was going to describe how I do backups over ssh, but then decided to
paste a script in :) It's worth noting that using scp to do backups is
fine, as other have noted, as is using rsync over ssh. It depends what
you want out of your backup mechanism.
The script below is run as root from cron on the machine dayna. A similar
script exists on each box I have running. The xxbackup user is able to
write to the /backup directory on the server avon.
The /etc/backup.exclude file includes the parts of the filesystem not to
backup. Here is what I have on the system dayna:
/cdrom
/floppy
/mnt
/proc
/tmp
/var/tmp
Periodically I bring home a firewire drive & backup the contents of
/backup on avon to this drive & take it back off site. This is sufficient
backup for my needs at home.
Yes, I always comment scripts this much :) Feel free to use or abuse this
short script as you see fit.
#!/bin/bash
#
# Backup the system to a remote backup server
#
##########
# Config #
##########
# Files not to backup
EXCLUDEFILE=/etc/backup.exclude
# Remote user & system
REMOTEUSER=xxbackup at avon
# Remote command
REMOTECOMMAND="bzip2 | cat > /backup/dayna.tar.bz2"
########
# Main #
########
tar -X $EXCLUDEFILE -cf - / | ssh $REMOTEUSER $REMOTECOMMAND
# End of script
Cheers,
-Rob
-- Robert Brockway B.Sc. email: robert at timetraveller.org ICQ: 104781119
Linux counter project ID #16440 (http://counter.li.org)
"The earth is but one country and mankind its citizens" -Baha'u'llah
More information about the OCLUG
mailing list