Setting Up SSH

So the first thing I need to do is setup a Linux VM.  I’m choosing to use Ubuntu 16.04 as my host VM.  From a base install of Ubuntu, I’m going to configure SSH by removing password authentication and requiring RSA key based authentication.  

 

Login to the Ubuntu Server and type in:

[shell]sudo nano /etc/ssh/sshd_config[/shell]

Remove the comment (#) from the line that has:

[shell]#PasswordAuthentication yes[/shell]

And change the “yes” to a “no”.  Do not restart the server!

 

Next, I’ll need to copy the public key to the server, but first I’ll need to create a private and public key combination.  I’ll start by downloading PuTTYGen.  I select Generate and follow the instructions to move the mouse to generate a random sequence.  Once the RSA keys have been generated, I’ll save them using the “Save public key” and “Save private key” buttons.

Copy the id_rsa.pub file to the server as ~/.ssh/authorized_keys.

 

Once I have the public key copied over, I’m good to go! I’ll restart the service using:

[shell]sudo service ssh restart[/shell], and I’ll be required to use my private key to connect over SSH.  Easy peasy.