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| +----[SHA256]-----+
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 firstname.lastname@example.org mkdir -p .ssh email@example.com's password:
Upload public key
You will need to place your public key (located in
.ssh/id_rsa.pub) to a
~ [ cat .ssh/id_rsa.pub | ssh firstname.lastname@example.org 'cat >> .ssh/authorized_keys' email@example.com's password:
The files/folders will need to have the correct permission so next execute the following command to ensure these are set;
~ [ ssh firstname.lastname@example.org "chmod 700 .ssh; chmod 640 .ssh/authorized_keys" email@example.com's password:
Now when you ssh to the server it should let you straight in without the need to enter your password.
~ [ ssh firstname.lastname@example.org Last login: Thu Dec 10 16:34:58 2015 from dhcp-10-61-xxx-xxx.xxx.com [robedwa@localhost ~]$