Unix rocks

I keep a album of photos at http://www.geeksrus.com/albums/ and I have been using Transmit to sync my local photo folder, which is generated by Simeon Leifer’s wonderful BetterHTMLExport. I’d noticed that transmit was not doing a proper job, and was slow!

So having recent learned how to use rsync over ssh, and learning how to use public/private keys with SSH on my web server (which also runs Unix, the same as Mac OS X) I was able to make a simple script to keep my web album folder in sync with the one on my hard disk. not only does it work, it is lightning fast!

Here is the script:

#! /bin/sh

cd ~/path/to/you/albums/

rsync -azv -e ssh –progress * yourlogin@your_ssh_server:path/to/remote/albums/

If you have set up a ssh key on your Mac, and put the public key on your server, then you can just run this script and wham, you’re synced! You can learn how to set up your ssh passwords by issuing the following command in the terminal, pressing space to get all of the text, then search for “password”

man ssh

here is the text that is important:

ssh implements the RSA authentication protocol automatically. The user creates his/her RSA key pair by running ssh-keygen(1). This stores the private key in $HOME/.ssh/identity and the public key in $HOME/.ssh/identity.pub in the user’s home directory. The user should then copy the identity.pub to $HOME/.ssh/authorizedkeys in his/her home directory on the remote machine (the authorizedkeys file corresponds to the conventional $HOME/.rhosts file, and has one key per line, though the lines can be very long). After this, the user can log in without giving the password. RSA authentication is much more secure than rhosts authen- tication.