SSH into DigitalOcean Droplet Terminal by SSH Keys & Console

Published

Modified

How to SSH into DigitalOcean Droplet SSH Key Private Key

This is a tutorial that shows you how to access DigitalOcean terminal first time after you created a new DigitalOcean droplet.

Connect DigitalOcean Terminal by DigitalOcean Console

The most simple method to connect to DigitalOcean droplet terminal is connected by the DigitalOcean console. You can go to the DigitalOcean terminal console by selecting a droplet that you want to access the terminal. Then click “Console” to open the DigitalOcean terminal console.

DigitalOcean Terminal Console Connect SSH

However, you and I will find the build-in DigitalOcean droplet is very hard to use compared with 3rd party open-source terminal emulators like the PuTTY.


DigitalOcean SSH Keys Creation

Once you’ve created a DigitalOcean droplet you need to choose the authentication method between SSH keys and a traditional Password to connect your DigitalOcean terminal.

DigitalOcean SSH Key Droplet Password Setting

For a newbie, using a traditional password is much more simple than using DigitalOcean SSH keys. But using SSH to connect DigitalOcean droplet terminal is more secure. If you are using a password for your droplet you can ignore the creation of SSH keys part.

SSH into DigitalOcean Droplet by PuTTY (Root Password)

To connect into DigitalOcean droplet by terminal you need terminal emulators like the PuTTY or OpenSSH. In this tutorial, we will use PuTTY which you can get it from https://www.putty.org/.

SSH into DigitalOcean Droplet Terminal PuTTY

Once, the PuTTY is open up, enter the following information to get into the DigitalOcean droplet:

  • Host Name (or IP address): IP address of the droplet.
  • Port: 22
  • Click “Open”.

Then, the terminal will open up. You need to enter the login user and password by doing the following step:

  1. Login as: root (then, press enter).
  2. Password: the password that you created since creating the droplet (then, press enter).
SSH into DigitalOcean Droplet Terminal
Enter your login and pass to access your droplet.

Note: Don’t be frightened, your password will not show up in the PuTTY terminal or DigitalOcean console for security reasons.


Create DigitalOcean SSH Keys

To connect to DigitalOcean droplet by SSH key, you need to create an SSH key and upload the public key to the DigitalOcean droplet.

First, you need terminal emulators like the PuTTY or OpenSSH. In this tutorial, we will use PuTTY which you can get it from https://www.putty.org/.

Install PuTTy and go to PuTTYgen (not a PuTTY that we use to connect to the DigitalOcean terminal). Then, click the “Generate” button and wait until it done.

When the key is generated, you’ll see the public key displayed in a text box as the following image. You need to copy the public key into a notepad or anything else. You need to add it to your DigitalOcean account later.

DigitalOcean SSH Key Generate Putty ssh key
Copy the public key into your notepad or anything. You need to add it to DigitalOcean later.

In case you want to add a password to your SSH key, you can add the password in the Key passphrase field and then retype the password again in Confirm passphrase field.

Once you’re done, click the Save private key button to save the SSH key as .ppl extenson.

Add DigitalOcean Droplet SSH Key

Now you need to add the SSH Key to the DigitalOcean which you can do with 2 methods:

  1. Add SSH keys at first during the Droplet creation process.
  2. Add SSH keys by go to Setting > Security > Add SSH Key.
DigitalOcean Droplet SSH Key
Add an SSH key by click on New SSH Key.

If you choose SSH keys as authentication at the droplet creation process, you can add an SSH key by click on New SSH Key.

Then, copy the public key and paste it into the SSH key content field, and set a name for the key in the Name field.

ssh to DigitalOcean droplet by PuTTY

SSH into DigitalOcean Droplet by SSH Keys

To SSH into DigitalOcean droplet by SSH key. First, you need to enter the DigitalOcean droplet’s IP address in the Host Name (or IP address) field and 22 in the Port field.

SSH into DigitalOcean Droplet Terminal PuTTY

Then, click on SSH in the left sidebar (under the Connection category). Make sure 2 is selected for the SSH protocol version as the image below.

SSH to DigitalOcean Terminal by SSH Keys

Double click on SSH again to expand and click on Auth. Browse the private key (.ppk file) that you saved at the generate SSH key process.

SSH into DigitalOcean Terminal with SSH keys

Next, click on Data in the left sidebar (under the Connection category). Enter the username that you want to auto-login for every time you SSH into DigitalOcean droplet by using SSH Key. Normally, we set it as “root”.

SSH DigitalOcean Droplet Terminal with PUTTY

Then, go back to the Session in the left sidebar (the first one). Name the preset in the Saved Sessions field and click the Save button.

How to SSH into DigitalOcean Droplet by SSH Keys Login

Now, instead of using a set root password, you can SSH into DigitalOcean droplet by using the private key by just choose a preset of your DigitalOcean droplet and click on the Open button.

DigitalOcean Terminal SSH Keys Login
Enter the passphrase from the SSH key creation process.

If you set a passphrase on the key itself at the SSH key creation process, you will be prompted for the key’s passphrase. If not, you’ll connect with no additional authentication.