`

JoyentJoyent

Knowledge Base

3.24. Backing up your site with rsync and SSH

This is written from a Mac OS X users perspective, but it applies to other unix types too!

The first thing you’ll need to do is generate your ssh keys (if you don’t already have them) and upload your public key to your TextDrive account.

  1. Open a terminal window
  2. Type ssh-keygen -d to generate your ssh keys
  3. Copy the contents of your public key ~/.ssh/id_dsa.pub in you local directory to the file /home/username/.ssh/authorized_keys on your TextDrive account.

You can append more than one public key to the authorized_keys file if you’re connecting from more than one location.

Note: You may have to create authorized_keys file if it’s not already there.

To back up your site to your local machine, type the following command in the terminal replacing username with your user name and yourdomain.tld with your site address:

Note: You may have to replace public with public_html if you have an older account.

rsync -a "username@yourdomain.tld:/home/username/public" /path/to/local/backupdir/ --times --links --recursive --hard-links -e ssh --progress --delete

This command uses rsync to synchronize everything in your public directory to a backup directory (in this case, backupdir).

(This was borrowed from Noel’s forum post with guidance from here)