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

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

Are you tired of encountering sudo apt-get install openssh-server not working error In 2024 then this blog post is absolutely for you. Yes in this tutorial, we are going to share you the methods to enable ssh server to fix the Sudo apt-get install OpenSSH-server not working error.

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

In this article, you will learn how to install OpenSSH in your Ubuntu & in other Linux-based operating system. You might be surprised as why we need to install OpenSSH as Ubuntu comes default with SSH as an OpenSSH server. You are right but  sometime you might not have SSH installed in your Ubuntu.

To make sure that you have OpenSSH installed in your Ubuntu, Run the following command to check it:

ssh -V

Install OpenSSH Server On Ubuntu 22.04

At first update the packages with the following command:

sudo apt-get update

Now, run the following command to install OpenSSH server on Ubuntu 22.04 LTS. Once the installation is complete, the SSH service will start automatically.

sudo apt-get install openssh-server

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 something like below in output:

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

How To Enable SSH On Ubuntu In 2024

Run the following command to enable and start SSH server services on Ubuntu.

sudo systemctl enable --now ssh

How To Enable SSH traffic on the Firewall

Run the following command to enable or 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 user_name@ip_address

Type yes and enter your password

How To Disable SSH on Ubuntu

Run the following command to disable SSH on Ubuntu. It is applicable for Linux Mint too:

sudo systemctl disable --now ssh

Leave a Comment