How to Secure Your VPS Server With SSH Keys

Since this is a marketing blog, I will keep my technical tutorials geared towards marketing professionals and entrepreneurs. Most of us own a virtual private server and hire programmers to upload work on our VPS. If you’re on Digital Ocean, using a password to login via SSH poses a great security threat since Digital Ocean IPs tend to face tens of thousands of brute force attempts every day. You should disable password login, and enable SSH keys to login.

First, get the user/freelancer to create a SSH key by following this Digital Ocean tutorial and have them send you the RSA key. It will look something like this:

ssh-rsa AAAAB3NzaC1yc2EAdf43dfSQABAAABAQDMu7E98pcHhLfwkF43fSitIx8n8/4Xx5lJdk232fDSWE1NE53WbhaH8p7jrOk2sjNE6KFzj697vaEWSfp3ZK4GVPpn0Kf3nJioBszqor6+ck6ckFek423RY+SN65jBm4e3GOE5ArdMPAzel9Nr0bV83QhRycqqLRDsd4iK+vcfe2OSbsJ1DSFk3kerkzWoFC3ogsXS5xj3ZlQK+Y0xHq1bdjsr34fdf34Fw4jejrdfslk492fn4jn23jRU0jk7jQ/VVzOgX4emh/7pD9IoiAY/RkLkzvgoK72N+cvNbHUrpUwqwYuC8ynKW+vr8gjRRnaDRdfj92mfm39wkm293 [email protected]

Secondly, you need to create a user on the server.

useradd <username>

Thirdly, you then need to add this string on a new line by first running su to get access to other user’s folders:


Then, you need to edit this file and add the string above to the last line of this file:

vim /home/username/.ssh/authorized_keys

To write and quit the editor, type:


Now you are all set. The third step is often where most people mess up. Digital Ocean offers an interface on their website to add SSH keys but I’ve never had luck using this.

No Comments

Leave a Reply