Verify SSH Service Status on Ubuntu Linux

This article provides a quick and straightforward guide on how to verify if the Secure Shell (SSH) service is actively running on your Ubuntu Linux system. You will learn the primary terminal commands to check the service status, verify that the SSH port is listening, and start the service if it is currently inactive.

Check SSH Status with systemctl

The most common and reliable way to check the SSH service on Ubuntu is by using the systemctl utility, which manages the systemd services.

Open your terminal and run the following command:

sudo systemctl status ssh

In the command output, look for the Active: line: * If the service is running, you will see green text saying active (running). * If the service is stopped, it will show inactive (dead).

Alternative: Use the Service Command

If you prefer using older sysvinit-compatible commands, you can achieve the same result using the service command:

sudo service ssh status

This will output the same status information as the systemctl command, displaying whether the daemon is active or inactive.

Verify SSH is Listening on Port 22

To ensure that the SSH service is actually listening for incoming connections on its default port (port 22), you can use the ss command:

sudo ss -tulpn | grep :22

If SSH is active and listening, you will see an output similar to this:

LISTEN 0      128          0.0.0.0:22        0.0.0.0:*    users:(("sshd",pid=1234,fd=3))
LISTEN 0      128             [::]:22           [::]:*    users:(("sshd",pid=1234,fd=4))

How to Start or Enable the SSH Service

If your checks reveal that the SSH service is installed but not running, you can manage it with the following commands: