I decided to put this down on “paper” as I always forget get how to set this up (guess I don’t do enough).

The following provides you with instructions on how to logon to your servers with out needing to enter your password every time, instead it will use your public SSH key.

Generate SSH key

To start you will need a public SSH key, if you haven’t already created one do the following;

~/ [ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/robedwa/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/robedwa/.ssh/id_rsa.
Your public key has been saved in /Users/robedwa/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:o0Hb/bMHAVjKvhuIPRRaGH3K13mNno8G/51CKf0pbyQ robedwa@ROBEDWA-M-Q00H
The key's randomart image is:
+---[RSA 2048]----+
|         o. .++. |
|       o.o. .=. .|
|      . + +.o.o++|
|     . o + +. +o=|
|      o S . .o.o.|
|       o . ooEo. |
|      .     =++o.|
|             =---|
|            .o=+o|

Target server

To setup the destination server to accept your key you will first of all need to ensure .ssh directory exists in your home. The quickest way to create is;

~/ [ ssh robedwa@ mkdir -p .ssh
robedwa@'s password:

Upload public key

You will need to place your public key (located in .ssh/id_rsa.pub) to a authorized_keys file;

~ [ cat .ssh/id_rsa.pub | ssh robedwa@ 'cat >> .ssh/authorized_keys'
robedwa@'s password:

Alter permissions

The files/folders will need to have the correct permission so next execute the following command to ensure these are set;

~ [ ssh robedwa@ "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
robedwa@'s password:

Test time

Now when you ssh to the server it should let you straight in without the need to enter your password.

~ [ ssh robedwa@
Last login: Thu Dec 10 16:34:58 2015 from dhcp-10-61-xxx-xxx.xxx.com
[robedwa@localhost ~]$