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

How is Livepatch safeguarded against bad actors?

Canonical Livepatch is a security patching automation tool which supports reboot-less security updates for the…

1 hour ago

Accelerating data science with Apache Spark and GPUs

Apache Spark has always been very well known for distributing computation among multiple nodes using…

1 hour ago

Cut data center energy costs with bare metal automation

Data centers are popping up everywhere. With the rapid growth of AI, cloud services, streaming…

1 day ago

Build the future of *craft: announcing Starcraft Bounties!

Our commitment to building a thriving open source community is stronger than ever. We believe…

1 day ago

NodeJS 18 LTS EOL extended from April 2025 to May 2032 on Ubuntu

The clock was ticking: Node.js 18’s upstream End of Life (EOL) The OpenJS Foundation is…

1 day ago

Native integration now available for Pure Storage and Canonical LXD

June 25th, 2025 – Canonical, the company behind Ubuntu, and Pure Storage, the IT pioneer…

2 days ago