How to set up ubuntu secure ssh login (AWS & Digital Ocean)

Ubuntu Initial Setup: setup ubuntu secure ssh login on digitalocean or Amazon Web Services EC2 instance

Download PDF:  Download Secure Login Cheat Sheet PDF

This post is a “cut to the chase”, “gitter dun” list of things to do for initial setup of an ubuntu server. To gain a deeper understanding of the process of securing your new ubuntu server, consult this well written article posted by ubuntu on the subject.

When starting up a new ubuntu server it is best to immediately take steps to secure the access to the server with the following steps.

As root, connect via ssh.

As root, make a new user .

As root, make the new user have sudo privileges.

Make ssh rsa keypair for the new user.

Copy local RSA key to remote authorized_keys
Digital Ocean


What this does on AWS ubuntu server:

As root, make /home/.ssh/authorized_keys have restricted access.

Passwordless Authentication: Configure ssh daemon
Edit sshd_config file to ensure that users can only connect with their SSH key

Make the following edits to the file. Search for the following settings and set them to the values shown below.

Then restart the ssh service

IMPORTANT: Before you log out, TEST.
Open a NEW TERMINAL use the new user to login.


Leave a Reply

Your email address will not be published. Required fields are marked *