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.
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.
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/.
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:
- Login as: root (then, press enter).
- Password: the password that you created since creating the droplet (then, press enter).
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.
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:
- Add SSH keys at first during the Droplet creation process.
- Add SSH keys by go to Setting > Security > Add 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 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.
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.
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.
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”.
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.
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.
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.