A client called me asking me to setup and configure SSH on a new Ubuntu server they got for a project. They needed the server to be accessed by a remote Web Developer they hired.

After having a great cup of coffee Villa Sarchi varietal I decided to take on this one.

Install SSH Server in Ubuntu

New Ubuntu installs do not have SSH service by default. You need to install it. It very easy. Run the below command on your Terminal:

sudo apt update

Then do:

sudo apt install openssh-server

Select ‘yes’ when asked. This last command will install SSH server in Ubuntu. Once the installation is done the SSH service will be started. You can check this by running this command:

sudo systemctl status ssh

Make the SSH server more secure using UFW in Ubuntu

UFW (Uncomplicated FireWall) is Ubuntu’s default firewall. Allow SSH port 22, port 8000, port 5000(these two are for testing only) on your Ubuntu server:

sudo ufw allow ssh
sudo ufw allow 8000
sudo ufw allow 5000

Then enable the firewall:

sudo ufw enable

To see what’s configured under your ufw rules:

sudo ufw status

This will give you a summary as the one below:

Configure SSH Server in Ubuntu
UFW status command output

Next, I needed to create a Linux user with sudo rights. You can tap on that link to see the steps necessary to do that. After you’re done you should be able to connect to the server using the following ssh command:

ssh youruser@yourserverIP

For example:

ssh pepe@192.168.2.11

You can also add your public key to the Ubuntu server. This way you don’t need to enter a password when you SSH. You can also add this server to a config file in your .ssh/config

I will be adding more details about security for SSH server. For now, visit my ITPro shop to see cool IT inspired T-Shirts and coffee mugs I designed.

Leave a comment

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