How to Enable SSH server on Ubuntu 22.04 Jammy Linux

Learn the simple steps to install and enable the OpenSSH server on Ubuntu 22.04 LTS Jammy JellyFIsh to connect it remotely over a secure protocol.

What is SSH in Linux systems?

SSH doesn’t need any introduction, its abbreviation stands for Secure Shell. With the help of Secure Shell, the users can secure network connections to access remote devices. It is a protocol that uses port 22 by default, which allows access to a remote computer in the IP network via an encrypted connection. It can be used as a secure alternative to unencrypted protocols such as Telnet or Rlogin. For example- you want to access your web server running on Amazon Cloud, to do this securely we can use an SSH server on the remote system. After that using a local SSH client the secure connection is possible. SSH enables mutual authentication and encrypted data transmission so that sensitive data such as passwords or user names cannot be spied out by unauthorized persons. Secure Shell offers a high level of security.

Well, SSH is not just limited to Linux systems, even Microsoft has implemented OpenSSH server in Windows 10 carried in Windows 11 as well. Hence, we can connect Windows over this protocol without installing any extra software. SSH works in server-client architecture.

Secure Shell works on the application layer (according to the ISO/OSI layer model on layers 5 to layer 7 ) and is based on TCP in the transport layer. According to the architecture described in RFC 4251, the SSH-2 protocol consists of three parts:

Transport Layer Protocol (RFC 4253)
Authentication Protocol (RFC 4252)
Connection Protocol (RFC 4254)

Enable SSH access

By default SSH would not be enabled, hence, to do that we have to install OpenSSH server by installing its packages available through our respective Linux systems.

SSH client

If you are using a current Windows 10 or a Unix system such as Linux or macOS, an SSH client for the command line is already preinstalled.

Steps to install OpenSSH server on Ubuntu 22.04 LTS Linux

1. Requirements

Ubuntu Linux
A non-root user with sudo rights
Terminal Access
Internet Access


2. Run System Update

Let’s first run the system update command to refresh Ubuntu 22.04 repository cache. This will also update the packages installed on your system.

sudo apt update -y


3. Install the OpenSSH server on Ubuntu 22.04

Like all the Ubuntu versions, the OpenSSH server is also available through the default system repository of Ubuntu 22.04 LTS Jammy JellyFish. Hence, we just need to run the system, APT package manager, to install it.

sudo apt install openssh-server -y

Enter your user password when the system asks for…


4. Enable and start the OpenSSH service

Once the installation is completed, let’s ensure the service of the OpenSSH is running without any error.

sudo systemctl status ssh

If it is not enabled and running already, then use this command:

sudo systemctl enable --now ssh


5. Open Port 22 on Ubuntu 22.04 LTS

Well, most of the time port 22 would already open in the firewall to access from the outside world, however, if not then we have to open the SSH service in the uncomplicated firewall of Ubuntu.

sudo ufw allow ssh

Whereas, those who are on the cloud need to whitelist this port in their service provider’s firewall service.


6. How to connect server over SSH

After installing the OpenSSH server we can easily connect it from our local machine it doesn’t matter if you are using Windows, Linux, macOS, or any other, the command syntax will be the same.

Just open your system’s command terminal and use the given syntax:

ssh user@server-ip-address


For example, if your user is h2s and Server-IP-address is, the command will be:

ssh [email protected]


7. How to Change default SSH port

Well, if the default port number of SSH (22) has been occupied by some other service or just for security reasons you want to change it then edit the ssh_config file, here is how to do that.

sudo nano /etc/ssh/sshd_config

There find a line #Port 22. Remove the # tag available in front of that and change the default port 22 to whatever you want to set. For example 2222.

Save the file using Ctrl+O, hit the Enter key, and then Ctrl+X to exit.

Change default default port

Note: Don’t forget to restart the SSH service to apply the changes.


8. How to Disable root login on SSH Ubuntu 22.04 Server

The SSH server running on Ubuntu 22.04 is accessible remotely using any available user on your system. However, if you want to restrict the users to login as root then that is possible as well. This means remotely the users can access log in to Ubuntu 22.04 via SSH protocol with any other user except root.

To disable root user login, again edit the SSHD configuration file:

sudo nano /etc/ssh/sshd_config

Find the line #PermitRootLogin and remove the #tag from it, so that the system can read it. And set its value to no as shown below in the screenshot as well.

PermitRootLogin no

Disable root login on SSH Ubuntu 20.04 Server

Note: Don’t forget to restart the SSH service to apply the changes.


9. How to restart the SSH service

The system while installing the SSH feature on our Ubuntu 20.04 with the help of the OpenSSH server package, it also creates a background service for it. This means with system boot it starts automatically if enabled. Hence, we can use systemctl to restart the SSH service to apply the changes we have made.

sudo systemctl restart ssh


10. How to stop or disable SSH

Well, if you don’t to anyone to log in Ubuntu 22.04 system using SSH protocol then we can stop and disable it.

To stop the SSH:

sudo systemctl stop ssh

However, after starting the service will automatically get started on the next system reboot if it is enabled. Hence, to disable that as well use:

sudo systemctl disable ssh


This was a quick guide to installing and starting with the SSH server on Ubuntu 22.04 Linux systems. This helps the user to log in to the remote server without physically attending to the machine using the local system.

Typical areas of application for Secure Shell are:

Secure administration of a remote computer via IP networks
Tunneling of applications based on TCP/IP in an encrypted, authenticated connection
Safe execution of commands on another computer
Secure transfer of files over an IP network
Secure delivery of complete file systems over IP networks
Securely transfer screen windows via X11


Other Articles:

2 ways to Install Sublime Text 3 on Ubuntu 22.04
How to install QEMU/KVM on Ubuntu 22.04
How to Install Microsoft Fonts on Ubuntu 22.04
How to Install Timeshift on Ubuntu 22.04



Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.