Home > tech > Backing up to a remote server

Backing up to a remote server

July 15th, 2007

If you aren’t me and/or don’t have a remote server, please move along. There’s nothing to see here. Unless you also would like to backup your files to a remote box or you are me and know that you will forget all of this goodness as soon as it’s done. In that case, read on…

Enable [tag]SSH[/tag] access to the server without having to supply a password:

generate an [tag]RSA[/tag] private key: ssh-keygen -t rsa

copy your public key to the server: scp ~/.ssh/id_rsa.pub user@example.com:~/

ssh to account: ssh user@example.com

append the public key to your authorized keys file and delete the file you uploaded:
mkdir .ssh
cat id_rsa.pub >> .ssh/authorized_keys
rm id_rsa.pub

set permissions:
chmod go-w ~
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

You should now be able to ssh into the server without a password.

Run [tag]rsync[/tag]

rsync -avz ~/source/ USER@SERVER:/foo/bar/destination

An [tag]AppleScript[/tag] to run rsync automatically

do shell script “rsync -avz –delete-after ~/source/ USER@SERVER:/foo/bar/destination”

(“delete-after” tells rscync to delete anything on the remote server that no longer exists on your local computer)

Save as “remote_backup.scpt” in /Library/Scripts

Use [tag]iCal[/tag] to run the AppleScript backup:

1. Launch iCal
2. Create a new calendar called “Scripting Cal”
3. Create a new event called “Remote Backup”
4. Set time to run
5. Set the alarm to “run script”
6. A new line will appear, asking you to point to the script you want to use. Navigate to “remote_backup.scpt” and click “select”
7. Set it to run 1 minute before the event
8. Set the event to repeat daily

admin tech

  1. J
    July 15th, 2007 at 20:09 | #1

    I really need to do this but could you repeat it in English for me? Maybe just come visit and do it for me – as usual!

  2. dan
    July 16th, 2007 at 13:41 | #2

    You know… some people just email this information from work home. But hey, we all know you’re special :)

  3. July 16th, 2007 at 20:22 | #3

    I am special :)

    I’ve gotten to the point where I don’t care what someone else did today and I have little interest in writing about what I did. So yes, the blog is basically dead.

    I’m just using the site as a personal repository rather than pulling the plug. The occasional person stumbles in and finds this stuff useful but it’s mainly for me.

  4. Rachel
    July 21st, 2007 at 12:01 | #4

    yawn

  5. July 21st, 2007 at 14:24 | #5

    yawn? yawn!? this is blogging gold baby!!

  6. J
    July 24th, 2007 at 08:19 | #6

    Nice to see new pics except for “that one” – yuck! what is it? Hope you have screens:) Maybe just cut the tree down -

Comments are closed.