Installing OpenSSH-server on Ubuntu 24.04 LTS Noble Linux

OpenSSH server offers Secure Shell (SSH) protocol on Ubuntu Linux to remotely manage the systems but securely with a high level of encryption. Although many Linux systems come by default with an OpenSSH server, however on Ubuntu 24.04 we have to install it manually. So, here in this tutorial, we go through the steps to install and configure the OpenSSH Server on our Ubuntu 24.04 system (this guide is also applicable for other versions 18.04, 20.04, and later)…

What is OpenSSH?

OpenSSH (Open Secure Shell) offers client-server architecture to provide encrypted communication over an unsecured network. It makes sure that we have secure channels to mitigate external and other attacks. Additionally, OpenSSH offers secure tunneling capabilities and various authentication methods along with remote management, file transfer, and port forwarding.

Step 1: Ubuntu 24.04 Package Update

Go to your Ubuntu system’s terminal and run the system update command to refresh the package list and install the latest versions of available applications.

sudo apt update && sudo apt upgrade -y

Step 2: Install OpenSSH Server on Ubuntu 24.04

All the Ubuntu versions including the Ubuntu 24.04 repository offer OpenSSH server package to install using the APT package manager. Hence, no need to add any third-party repository.

sudo apt install openssh-server -y

Step 3: Enable and Start SSH Service

The service of the SSH server will not be started automatically on Ubuntu 24.04 after completing the installation. Therefore, using the given command we not only activate the OpenSSH-server service but also enable it, this will ensure the SSH server will automatically get started every time with system boot.

sudo systemctl enable --now ssh

To check the service status, use:

sudo systemctl status ssh --no-pager -l

You should see an output showing the SSH service is active and running.

Enable and Start SSH Service

Step 4: Adjust Firewall Settings

Now, if your Ubuntu 24.04 has an active firewall such as UFW (Uncomplicated Firewall), we have to whitelist port 22 or allow SSH traffic through it:

Check the status of UFW whether it is active or not.

sudo ufw status

If the firewall is “active” then we have to allow SSH through the firewall:

sudo ufw allow ssh

(Optional) However, if your Firewall is “inactive” and you want to “active” UFW on Ubuntu 24.04, if it is not already enabled, here is the command to use:

sudo ufw enable

Step 5: Configure OpenSSH Server (Optional)

Well, we don’t need to change anything for using the SSH server after its installation, however, those who want to enhance security or want to perform any kind of customization can modify the the SSH configuration file located at /etc/ssh/sshd_config.

Here are a few common adjustments:

Open the SSH configuration file:

sudo nano /etc/ssh/sshd_config

Change the default SSH port (optional but recommended for security):

Find the line #Port 22 and change it to a different port number, for example:
Port 2222.

Remember to allow the new port through the firewall:

sudo ufw allow 2222/tcp

Disable root login for security:

Find the line PermitRootLogin and change it to:

PermitRootLogin no

Restart the SSH service to apply changes:

sudo systemctl restart ssh

Step 6: Test the SSH Connection

After having all the settings in their place, we can test the SSH connection by connecting Ubuntu 24.04 from any other remote machine using the following command syntax. Just replace “username” with your actual “username” and “server_ip” with your server’s IP address:

ssh username@server_ip

For example, if our Ubuntu 24.04 server IP address is and Username is linuxshout then the command to connect it through the remote computer will be like this:

ssh [email protected]

Whereas, if you are using some custom port such as 2222 then we also need to mention that in the command, as shown below:

ssh -p 2222 [email protected]


Installation of an OpenSSH Server on Ubuntu is quite an easy job to do, however, configuring and customizing it as per the need can be difficult for new users. Nevertheless, the internet is full of different guides and documents to help users in the best possible to manage remote systems using SSH safely and securely.

Other Articles:

Leave a Comment

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