configure passwordless SSH login

STEP ONE – Generating the key pair

1) Generate an RSA private key using ssh-keygen (unless you have already created one).

 ssh-keygen -t rsa

This creates a public/private keypair of the type (-t) rsa.

 Generating public/private rsa key pair.
Enter file in which to save the key (/Users/YOUR-USER-HERE>/.ssh/id_rsa):

Once the keypair is created, you are prompted to enter the following items.

2) Click Enter on your keyboard to continue.

 Enter passphrase (empty for no passphrase): 

3) Click Enter (AGAIN) on your keyboard to continue.

 Enter same passphrase again (empty for no passphrase): 

4) Click Enter on your keyboard to continue.

5) When finished, click Enter on your keyboard.

STEP TWO – Copying the public key you just created on your home computer to your server

1) Run the following command to copy the public key on your local computer to server.

cat ~/.ssh/id_rsa.pub | ssh username@yourserver.com "mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys"

STEP THREE – Confirming the SSH connection

ssh username@yourserver.com

***Notes taken from this post

Leave a Reply

Your email address will not be published. Required fields are marked *