Using authorized_keys2 file instead of passwords is a huge time saver. Also a little bit more secure. As long as you keep your key files secure on your computer.
First a few prerequisites.
1. You need to ensure that OpenSSH is installed on your box.
2. You need to have connected to at least one machine. You need to make sure that your .ssh folder is in your home directory.
Now on to the good stuff.
Here is how I do it:
1. First you need to create a private DSA key with OpenSSH.
ssh-keygen -t dsa
It will prompt you for a password. This is your backup to a compromised system. You can use one if you wish, you don’t have to if you don’t want to bother with a password. This creates one file in particular that is important: ~/.ssh/id_dsa.pub. The other file it creates is just id_dsa and it is in the same location as well. One is a private key, id_dsa, and the other is a public key, id_dsa.pub.
2. Now you need to place your public key in the ~/.ssh/authorized_keys2 file on the target computer. Depending on your setup there are a couple of ways to make this happen. First way is to just scp the file to the new box.
scp ~/.ssh/id_dsa.pub account@my.server.com:/home/account/.ssh/authorized_keys2
Second way is to append the public key to the authorized_keys2 file on the remote machine:
cat ~/.ssh/id_dsa.pub | ssh account@my.server.com -C ‘cat – >> /home/account/.ssh/authorized_keys2′
That should pretty much do it. Pretty simple thing you can do to help secure your machine and make connecting to your remote boxes quick and painless.