How to set up OSX to connect to a linux sever via password-less SSH

We connect from our Macs to our linux web servers dozens of times per day and typing a password for each login wastes time.  The solution is to set up passwordless SSH logins.  However most how to's on the web use ssh-copy-id to complete this task and it doesn't come standard on OSX Lion.

Here, in five minutes or less, is how to set up passwordless login viz ssh without ssh-copy-id:

First, on your local machine generate a SSH key using ssh-keygen.

ssh-keygen

In most cases you can accept the default entries and the key file will be placed in ~/.ssh/id_rsa

To copy the key to your remote server:

cat ~/.ssh/id_rsa.pub | ssh user@example.com 'cat >> ~/.ssh/authorized_keys'

This will append the new key to the authorized_keys file.

Now connect via SSH to verify that it works.

ssh user@example.com

You're ready to go!