Oreilly O really
Bruce Marshall
bmarsh
Mon Nov 1 18:40:55 PST 2004
On Monday 01 November 2004 05:16 pm, James McDonald wrote:
> I presume most of us look to this list or google when we have admin
> questions. However I have found that for myself the good old fashioned
> paper book is sometimes the best way to soak up information.
>
> One thing that has been annoying me is my lack of backup strategy so
> when I saw a section in an Oreilly book "Linux Server Hacks - 100
> Industrial-Strength Tips & Tools" on backup. I bought it... 20minutes
> after getting it home I had ssh public key authentication working and a
> rough script for network backup going.
>
> What I did follows.
>
> Firstly I had to enable public key login by running the following on the
> source box as root
>
> ssh-keygen -t rsa
>
> and then copying the resulting public key to the target box, again as root
>
> scp .ssh/id_rsa.pub target_server:.ssh/authorized_keys2
>
Another method of doing this:
ssh-copy-id -i .ssh/id_rsa.pub <user>@<hostname>
The above is good for more than one host. I think your method would overwrite
the authorized_keys2 file if you did it from more than one server.... thus
losing the key for the first server.
> Once the public key is installed you can test it by simply sshing to the
> box as root
>
> ssh servername
>
> To get backup going I made up this script very rudimentary....
>
> I could have chosen to make one large remote tar ball but I chose to
> split it up into
> functional tars
>
> #!/bin/sh
> # filename: /home/jamesm/bin/backup
>
> # things to backup
>
> # mail
> # apache config
> # website
> # home drive
> # svn db
>
> REMOTE_DIR=/mnt/hde1/backup
>
> MYMAIL=/home/vpopmail/domains/jmcd.dyndns.org/jamesm/Maildir
> tar -czvf - $MYMAIL | ssh mx1 "cat > $REMOTE_DIR/amd-jamesm-mail.tar.gz"
>
> APACHE_CONFIG="/etc/httpd/access \
> /etc/httpd/conf \
> /etc/httpd/conf.d"
> tar -czvf - $APACHE_CONFIG | ssh mx1 "cat > $REMOTE_DIR/amd-apache.tar.gz"
>
> SVN=/opt/subversion
> tar -czvf - $SVN | ssh mx1 "cat > $REMOTE_DIR/amd-svn.tar.gz"
>
> MYHOME="/home/jamesm/Docs \
> /home/jamesm/.ssh \
> # /home/jamesm/mp3 \ probably not needed to backup mp3 or oggs every day
> # /home/jamesm/ogg \
> /home/jamesm/bin"
> tar -czvf - $MYHOME | ssh mx1 "cat > $REMOTE_DIR/amd-myhome.tar.gz"
>
> MYWEB=/var/www/html
> tar -czvf - $MYWEB | ssh mx1 "cat > $REMOTE_DIR/amd-web.tar.gz"
>
> you can run the above manually but it's probably easier to put it in
> root's crontab
> then all that is left is to run as root
>
> crontab -e
>
> and add a line to get it to backup every day at 2:05 am to call the script
>
> 05 2 * * * /home/jamesm/bin/backup
>
>
> _______________________________________________
> Linux-users mailing list
> Linux-users at linux-sxs.org
> http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
>
>
>
> !DSPAM:4186b7a4125981827988241!
--
+----------------------------------------------------------------------------+
+ Bruce S. Marshall bmarsh at bmarsh.com Bellaire, MI 11/01/04 18:38 +
+----------------------------------------------------------------------------+
"Don't ask me; I was hired for my looks."
More information about the Linux-users
mailing list