Digital Ocean with SSH access
In this post we will create a new machine (Droplet) in your Digital Ocean account and secure it with SSH access
Step 1: Make sure you have SSH configured
Go to Digital Ocean's dashboard, navigate to Settings
> Security
Add your SSH keys there.
Step 2: Create a droplet
Go to Digital Ocean's dashboard, click the "Create" button on top of the page and select "Droplet"
Option | Value |
---|---|
Choose an image | Whatever Ubuntu image is available now |
Choose a plan | Basic, at the moment $5/mo |
Choose a DataCenter | anywhere you want |
VPC | no |
Options | [x] IPv6 (if you fancy) [ ] User data [x] Monitoring |
And then click on Create.
Step 3: Login with SSH
Let's make sure you have ssh access to your new machine.
First let's get you a root password: go to Dashboard, click on your droplet's name, go to Access and ask for a new root password. You will receive your password via email.
Back to Dashboard, then navigate to Droplets and copy the IP address of your new droplet. I will use 1.2.3.4
as an example.
Open a terminal and let's access your server. Whenever prompted about a new host, confirm (Y) and continue.
You should be inside your droplet now. You will need to change your password the first time you access it.
ssh root@1.2.3.4
...
...
Changing password for root.
(current) UNIX password: [paste-root-password-here]
Enter new UNIX password: [new-password]
Enter a new password and repeat it. Once done, let's confirm everything is fine, by closing our session and connecting again. Run exit
and reconnect:
Ok, now let's remove password access from your machine. Yes, we don't want that.
Locale the line with PermitRootLogin
and replace yes
with prohibit-password
Now only ssh access with your keys is allowed.
Make sure you don't lose your keys! 😅
Next
Read more about security-related changes or check this article from DigitalOcean about SSH