Here is a very nice How To tutorial on SSH Keys Otherwise the cliffnotes:

Generate an SSH Key pair and upload public key to remote host

ssh-keygen -t rsa

Use ALL defaults, or…

ssh-keygen -f anyname-you-want-for-your-key -N '' -t rsa -q

-N ” = no password which is the point of this excersize

Check that you have generated the key in ~/.ssh

You may need to create the directory .ssh first

cat .ssh/ | ssh -v -p 22 'cat >> .ssh/authorized_keys'

NOTE: DO NOT SUDO or key will be copied into the root .ssh directory

To specify a port other than -p 22 = port 22

ssh -v -p 22

If you get an error, its probably because there are other keys / known_hosts conflicting. Fix problem by removing key listed in the verbose output

(some housecleaning might be necessary)

cd .ssh
sudo rm id_*
sudo rm known_hosts

(or use vi to delete by line)

Once logged in to remotehost, repeat housecleaning

You may also like...