notbrainsurgery (notbrainsurgery) wrote,
notbrainsurgery
notbrainsurgery

godaddy backup with rsync over ssh

I have recently moved one of my web servers containing mostly static pages to GoDaddy hosting. Before it was hosted at Linux machine and I was backing it up using weekly cron sript using rsync. With new hosting I had to set up a new backup procedure. The problem us that although GoDaddy gives you SSH access they do not provide rsync on their machines. I was toying with idea of cross-compiling it elsewhere and bringing a binary with me, but I found a simpler solution using sshfs. Here are step by step instruciton:

Definitions:

www.yourhost.com - your go daddy web host (assuming it has ssh access)
username - your login name for ssh access to go daddy host
backuphost- a Linux machine with root access, at which you will be backing up your web site.

on backup host:

1. As root, generate new ssh key without passphrase using ssh-keygen command. Call it backup.dsa. (normally stored in /root/.ssh/backup.dsa)

2. Add the following lines to your /root/.ssh/config

Host www.yourhost.com
User username
IdentityFile ~/.ssh/backup.dsa


3. Make sure you have empty mount point (mkdir /mnt)

on www.yourhost.com:

1. Add contant of the file backup.dsa.pub (one you generated on backup host) to ~/.ssh/authorized_keys

Now we are all set. Let us try it:

First just try to see if your ssh works. As root issue the command:

ssh www.yourhost.com

It should let you in without password. If this does not work add -v flag to ssh command and proceed with regular troubleshooting of ssh public key authentication. Most likely you will need to fix permissions on ~/.ssh directory and its contents on the remote host.

Once this worked, you can mount remote filesytem:

sshfs www.yourhost.com: /mnt

And back it up:

rsync -az -qq /mnt/html/ ~/backups/www.yourhost.com

Do not forget to unmount when you done:

umount /mnt

This is a quick and dirty solution. Most likely fusefs options could be tweaked to get even better performance. You can add these commands to script file in /etc/cron.weekly/ on backup host to implement automatic weekly backups.
Tags: backup, fusefs, godaddy, linux, rsync, ssh
Subscribe

  • email backup service

    I generally save all email I send and most of email I receive. I have megabytes of email archives, some dating back more than 10 years. I also have…

  • linksys firewall recovery

    I am using Linksys router with Sveasoft firmware as my home firewall. I am very happy with the setup. However today after doing some minor firewall…

  • spam dictionary attacks and sendmail

    I am in constant fight with spam. The reason is that I believe in single, universal, life-long email address and refuse to hide or change my primary…

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your IP address will be recorded 

  • 2 comments