How to Install OpenSSH on Ubuntu 20.04

What is OpenSSH?

OpenSSH is a connectivity tool that allows secure communication between client and server. The traffic is encrypted to discourage eavesdropping, connection hijacking, MITM attack, and other attacks.

In today’s guide, we will show you how to install OpenSSH server on an ubuntu machine. The installation will take place using the terminal with the help of a few easy-to-follow commands.

Let’s get started!

Installation Guide:

Following are the steps involved in installing OpenSSH server in Ubuntu:

Step 1: Install OpenSSH Server

To install OpenSSH server, issue the following command:

sudo apt-get install openssh-server

Step
Sponsored
2: Enable SSH

In this step, we will enable SSH to allow log in from remote machines. It can be done by running the following command:

sudo systemctl enable ssh

Step 3: Start SSH

Now that we have enabled the service, let’s start it. To do that, run this command:

sudo systemctl start ssh

Step 4: Test SSH Login

Now we will check whether we can access the server via ssh from a remote machine or not. To do that, log in to the system using your username and the IP address of the server machine.

ssh tom@10.254.153.43

OpenSSH server installation and configuration

SSH to remote server using bmc/kvm/ipmi over IP

We are using OpenPOWER based system known as Talos II from Raptor computing systems. Since it does not come with SSH server installed on it, this is how we will log in to bmc server to get access to the serial console.

ssh root@power9-bmc

Run obmc console

To get access to the Ubuntu server console, run the obmc-console-client by executing this command:

# obmc-console-client

Install OpenSSH server on Ubuntu

Step 1: Update the system

Firstly, update the system. To do that, execute the following command:

sudo apt update

Step 2: Upgrade the system

After updating, we will upgrade the system. Run the following command to do that:

sudo apt upgrade

Step 3: Install sshd server on Ubuntu

In this step, we will install the openssh-server package by issuing the following command:

sudo apt install openssh-server

Step 4: Check the status of the service

Let’s verify whether the ssh service is running fine or not. Run this command to do that:

Sponsored
sudo systemctl status ssh

Step 5: Enable and start SSH

Now, let’s run the SSH service. First, enable it by running the following command:

sudo systemctl enable ssh

Once the service is enabled, start the service by issuing the following command:

sudo systemctl start ssh

Configure Firewall and open port 22

We also need to allow SSH service through firewall. To do that, we will configure ufw, the firewall present in Ubuntu.

Allow SSH

To allow SSH on ufw, run this command:

sudo ufw allow ssh

Enable SSH

Next, we will enable SSH. It can be done by running the following command:

sudo ufw enable

Check firewall status

Now check the status of the ufw firewall by running the following command:

sudo ufw status

Test SSH login

SSH to the OpenSSH server

You can now log in OpenSSH server from a desktop machine using SSH. It can be done this way:

ssh tom@10.254.153.43

ssh tom@power9

Enable password less access

To allow password less login, you can copy and install the public key using ssh-copy-id command like this:

ssh-copy-id tom@power9

That’s all folks!

In this tutorial, we had a thorough look at how to install OpenSSH server on Ubuntu 20.04. We also saw how we can configure it for remote access and how to allow SSH service through Ubuntu’s firewall.

I hope you had a great learning time here.

Ubuntu Server Admin

Recent Posts

AI in 2025: is it an agentic year?

2024 was the GenAI year. With new and more performant LLMs and a higher number…

4 hours ago

Canonical announces 12 year Kubernetes LTS

Canonical’s Kubernetes LTS (Long Term Support) will support FedRAMP compliance and receive at least 12…

1 day ago

Ubuntu Weekly Newsletter Issue 878

Welcome to the Ubuntu Weekly Newsletter, Issue 878 for the week of February 2 –…

2 days ago

How your feedback shapes the way we support open source software

At Canonical, we firmly believe that delivering an outstanding, customer-centric support experience is impossible without…

2 days ago

How To Install osTicket v1.14 On Ubuntu 20.04

I want to share how to install osTicket v1.14 for Ubuntu 20.04 server. osTicket written…

3 days ago

How To Install WordPress On Ubuntu 20.04

Now I want to share how to install WordPress on ubuntu 20.04 server. WordPress is…

3 days ago