If you didn’t enable the OpenSSH server during the Ubuntu 24.04 in­stall­a­tion, don’t worry! You can easily activate it later. Simply install OpenSSH via the Terminal and adjust the SSH con­fig­ur­a­tion to suit your security re­quire­ments.

Free VPS Trial
Try a virtual server risk-free for 30 days

Try out your VPS for 30 days. If you're not satisfied, we'll fully reimburse you.

How to enable SSH on Ubuntu 24.04 step by step

The SSH protocol is now a standard for secure access to remote servers or computers. It not only ensures encrypted data trans­mis­sion but also protects against un­au­thor­ised access and tampering. In modern Linux systems like Ubuntu 24.04, the open-source solution OpenSSH is typically used for this purpose.

Note

When setting up a server with Ubuntu, you can enable SSH during the initial setup, so you won’t need to install it later.

OpenSSH not only enables remote access but also allows secure file transfer via SFTP and SCP. Since the SSH service is not auto­mat­ic­ally active in Ubuntu after in­stall­a­tion, it needs to be set up first. Creating your own SSH keys on Ubuntu can also be done in a few steps.

Learn how to set up OpenSSH on Ubuntu 24.04 and discover the available con­fig­ur­a­tion options in this step-by-step guide.

Step 1: Open terminal

First, open the command line tool of your Linux dis­tri­bu­tion. There are several ways to do this. Either by right-clicking on the desktop > Open in Terminal and using the shortcut [Ctrl] + [Alt] + [t], or by opening the ap­plic­a­tions menu and using the search function. Just type ‘Terminal’ in the search field.

Image: Screenshot of the Ubuntu app searc
Ubuntu search function in the app overview: Search for “Terminal”

Step 2: Install the Ubuntu SSH service

Next, install OpenSSH. To do this, the Ubuntu package manager apt is used with the sudo command as the root user. The following terminal command starts the in­stall­a­tion:

sudo apt install openssh-server
bash
Image: Screenshot of the installation of OpenSSH in the terminal
The OpenSSH in­stall­a­tion simply takes place in the Ubuntu terminal.

Since you are acting as a superuser, you need to enter your password before the in­stall­a­tion and confirm this entry by pressing Enter.

Step 3: Verify success

Once the in­stall­a­tion is complete, confirm its success by checking the status of your SSH daemon. Do so easily via the terminal using the following command:

sudo systemctl status ssh
bash

Now look at the output of this command. You should find the following entries:

  • “active (running)”: This status indicates that the Ubuntu SSH service is currently running.
  • “preset: enabled”: Look at the ‘Loaded’ line and search for the entry ‘preset: enabled.’ It indicates that SSH will be available at every system restart.
Image: Screenshot of the status of SSH in the terminal
You can see from the green “active” display that SSH is activated.

If the status shows that your SSH service is currently inactive, you need to change this manually. You can also use the terminal for this. Enter the following commands to enable SSH:

sudo systemctl enable ssh
sudo systemctl start ssh
bash

To exit the SSH service status display and return to the command prompt, simply press the q key for ‘quit.’

Step 4: Open SSH port

For remote access via SSH to your Ubuntu 24.04 system to work, the system must also be ‘ac­cess­ible from external sources’. More spe­cific­ally: The correct network port must be open. By default, SSH runs over port 22. As long as this is blocked by the firewall, every con­nec­tion request will be un­suc­cess­ful.

Ubuntu uses a tool called UFW (Un­com­plic­ated Firewall) to control the internal firewall. To ensure SSH con­nec­tions are not blocked and you don’t have to fix SSH errors later, you need to set up an explicit allowance for port 22. Only once this rule is set can remote access be suc­cess­fully es­tab­lished with tools like PuTTY or other SSH clients. The command to set up this allowance is as follows:

sudo ufw allow ssh
bash
Image: Screenshot of the command to update the firewall
The SSH port release is also carried out using a command in the Ubuntu terminal.

Step 5: Make con­fig­ur­a­tion changes

The default OpenSSH settings already provide a solid found­a­tion for secure remote access on Ubuntu 24.04. However, if you have specific re­quire­ments for security or network structure, you can customise the SSH server’s behaviour. For instance, you can change the default port 22, se­lect­ively enable or disable IP addresses, or disable con­nec­tion for­ward­ing (TCP for­ward­ing) depending on what your en­vir­on­ment requires.

All relevant options can be found in the central con­fig­ur­a­tion file sshd_config, which is used to manage the SSH daemon. To edit this file, simply open it with an editor of your choice. We’ve chosen the vim editor, so the command is as follows:

sudo vim /etc/ssh/sshd_config
bash
Image: Screenshot of the sshd_config file
You can customise the content of the OpenSSH con­fig­ur­a­tion file sshd_config in an editor of your choice, such as vim.

Now make the desired changes to the con­fig­ur­a­tion file – such as adjusting ports, re­strict­ing allowed protocols, or setting secure au­then­tic­a­tion methods. Be sure to save your changes before closing the editor.

To apply the new settings, restart the SSH service. You can do this with the following command in the terminal:

sudo service ssh restart
bash
Tip

Con­fig­ur­ing SSH is par­tic­u­larly useful if you want to run an FTP server on Ubuntu. This setup lays the ground­work for using SFTP – the secure al­tern­at­ive to tra­di­tion­al FTP, with en­cryp­tion and data pro­tec­tion already built in.

Go to Main Menu