Backing up to a remote server

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 SSH access to the server without having to supply a password:

generate an RSA 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 rsync

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

An AppleScript 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 iCal 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

Technorati Tags: , , , ,

6 comments ↓

#1 J on 07.15.07 at 8:09 pm

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 on 07.16.07 at 1:41 pm

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

#3 admin on 07.16.07 at 8:22 pm

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 on 07.21.07 at 12:01 pm

yawn

#5 midbach on 07.21.07 at 2:24 pm

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

#6 J on 07.24.07 at 8:19 am

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