How to install openssh on ubuntu 20. 04

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

How to install openssh on ubuntu 20. 04 1

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

How to install openssh on ubuntu 20. 04 2

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

How to install openssh on ubuntu 20. 04 3

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

How to install openssh on ubuntu 20. 04 4

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

How to install openssh on ubuntu 20. 04 5

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

How to install openssh on ubuntu 20. 04 6

Step 2: Upgrade the system

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

sudo apt upgrade

How to install openssh on ubuntu 20. 04 7

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

How to install openssh on ubuntu 20. 04 8

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

How to install openssh on ubuntu 20. 04 9

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

How to install openssh on ubuntu 20. 04 10

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

sudo systemctl start ssh

How to install openssh on ubuntu 20. 04 11

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.

See also  How to empty trash from Ubuntu terminal

Allow SSH

To allow SSH on ufw, run this command:

sudo ufw allow ssh

How to install openssh on ubuntu 20. 04 12

Enable SSH

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

sudo ufw enable

How to install openssh on ubuntu 20. 04 13

Check firewall status

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

sudo ufw status

How to install openssh on ubuntu 20. 04 14

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

How to install openssh on ubuntu 20. 04 15

ssh tom@power9

How to install openssh on ubuntu 20. 04 16

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

How to install openssh on ubuntu 20. 04 17

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.


Discover more from Ubuntu-Server.com

Subscribe to get the latest posts sent to your email.

Comments

No comments yet. Why don’t you start the discussion?

    Leave a Reply