Setting Up SSH to Connect to Your DigitalOcean Droplet in macOS Sierra

Setting Up SSH to Connect to Your DigitalOcean Droplet in macOS Sierra

I recently encountered a ssh few connection hiccups after upgrading from El Capitan to macOS High Sierra. The main hiccup being that I was constantly prompted for a password when connecting to my digital ocean droplet. This quick tutorial is written to help those who might be experiencing the same issues connecting to their droplets via SSH.

Note: This tutorial assumes you have root access to your Digital Ocean Droplet

From the beginning

Start by opening up the terminal and generating the ssh keys with the following command:

$ ssh-keygen -t rsa

The resulting process will look similar to the following:

Optional

At the following line, I recommend giving your key a unique name. Make sure you enter the full path of the renamed key:

Configure SSH hosting profiles for convenient login

Instead of entering ssh user_name@123.456.789.012 all the time, we want to simply enter into the terminal ssh droplet_rsa, a hosting profile and connect to our droplet. To accomplish this, edit your config file located in the .ssh folder, (if you don’t have one, that’s ok) by entering the following command:

Add the following hosting profile:

Next, make sure that the ssh keys will be added to the keychain to avoid the password prompt when logging into your droplet:

Copying your public key to your Digital Ocean host

The final step in this process requires the copying of the newly created public key to your host with the following command:

Now when you login with:

you will not longer be prompted for a password.

Additional Users

If you want to add additional users, repeat the Configure SSH for convenient login and the Copying your public key to your Digital Ocean host steps

Leave a comment below for questions or corrections!