Jul 072010

If you want to connect to remote machine named othermachine as user named othermachineuser.

On your local machine you need to generate a private-public keypair using ssh-keygen as follows (You only need to do this once):
ssh-keygen -t dsa

This will create a private and public keypair which is stored in ~/.ssh directory.

Next run the following command once for every machine you want to remotely login without specifying password:
scp ~/.ssh/id_dsa.pub othermachineuser@othermachine:~/.ssh/authorized_keys

Now you can login to the machine using ssh without requiring to specify any password. Your public key, which you copied to the remote machine, is checked (not directly) against your private key to verify your authenticity.