Linux Tutorials

Fix sudo apt-get install openssh-server not working error : Enable SSH Server on Ubuntu

Fix sudo apt-get install openssh-server not working error : Enable SSH Server on Ubuntu
Written by itsubuntu

Fix Sudo apt-get install OpenSSH-server not working error

In this tutorial, we will show you the methods to enable ssh server to fix the Sudo apt-get install OpenSSH-server not working error. SSH (Secure Shell) is a standard network tool. It is mostly used to establish a secure connection between systems in the network. If you are using Ubuntu then Ubuntu comes by default with SSH as an OpenSSH server but sometime you might not have SSH installed in your Ubuntu.

Fix sudo apt-get install openssh-server not working error

In this article, you will learn how to install OpenSSH in your Ubuntu & Linux-based operating system so that you won’t come across the Sudo apt-get install OpenSSH-server not working error.

You can also run the following command to check if you have OpenSSH installed in Ubuntu or not:

ssh -V

Install OpenSSH Server on Ubuntu 22.04

First of all, make sure that your current packages are updated:

sudo apt-get update

Now, run the following command to install OpenSSH server on Ubuntu 22.04:

sudo apt-get install openssh-server

Once the installation is complete, the SSH service will start automatically. Run the following command to verify that SSH is running or not in your system after installation:

sudo systemctl status ssh

You will see the output something like below:

● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-04-07 10:21:00 CEST; 6h ago
...

Enable SSH On Ubuntu

If SSH server is not enabled and not starting then run the following command to enable and start SSH server services on Ubuntu.

sudo systemctl enable --now ssh

Enable SSH traffic on the Firewall

Run the following command to allow SSH traffic on the Firewall

sudo ufw allow ssh

Connecting to the SSH Server

Run the following command to connect to SSH server:

ssh username@ipaddress

Type yes and you’ll be prompted to enter your password

Disabling SSH on Ubuntu

Run the following command to disable SSH on Ubuntu:

sudo systemctl disable --now ssh

About the author

itsubuntu

Leave a Comment