AMZ DIGICOM

Digital Communication

AMZ DIGICOM

Digital Communication

Configure an openssh server under Ubuntu 24.04

PARTAGEZ

You have not activated the SSH Openssh server, included by default in Ubuntu 24.04, during installation? Don't worry, you can do it at any time. You can install Openssh later via the terminal and adjust the configuration of the SSH service to your safety requirements.

Activate SSH on Ubuntu 24.04: Instructions step by step

For secure access to distant servers or computers, the SSH protocol has become an essential standard. It guarantees not only a transfer of encrypted data, but also effectively protects against unauthorized access and manipulation. In modern linux systems like Ubuntu 24.04, the Open Source OpenSsh solution for that.

Note

When configuring a server with Ubuntu, you can activate SSH from installation, avoiding having it later.

OpenSSH not only allows remote access, but also the secure transfer of files via SFTP and SCP. As the SSH service is not automatically activated under Ubuntu 24.04 After installation, it must first be configured. Creating your own SSH keys under Ubuntu can also be carried out in a few steps.

Find out below how to configure Openssh under Ubuntu 24.04 and which configuration options are available.

Step 1: Open the terminal

First, open theCommand line tool of your Linux distribution. For this, several options are available to you. In addition to a right click on the desktop> « Open in the terminal » and the use of the shortcut [Ctrl] + [Alt] + [T]you can also open the app menu and use the search function. Just type « terminal » in the research field.

Image: Search screenshot in the Ubuntu application
Ubuntu search function in the preview of applications: search for « terminal ».

Step 2: Installation of the Ubuntu SSH Service

The next step is the installation of OpenSSH. To do this, use the Ubuntu Apt packet manager with the Sudo command as a root user. The following command in the terminal launches the installation:

sudo apt install openssh-server

bash

Image: screenshot of the installation of OpenSsh in the terminal
The installation of OpenSSH is simply done in the Ubuntu terminal.

Since you act as superuser, you will have to enter your password before installation and validate this entrance with [Entrée].

Step 3: Check the success of the installation

After performing the installation order and completing the installation, you can check the success of the operation by consulting the status of your SSH demon. This is also easily done via the terminal with the following command:

sudo systemctl status ssh

bash

Now examine the release of this order. You should find the following entries:

  • Active (running) : This status indicates that the SSH service of Ubuntu is running.
  • Preset: Enabled : Consult the line loaded And search for the entry preset: enabled. This indicates that SSH will now be available for each system restart.
Image: screenshot of SSH status in the terminal
The « active » green light indicates that SSH is activated.

If the status indicates that your SSH service is currently inactive, you will have to modify it manually. You can use the terminal again for this. Enter the following commands to activate SSH:

sudo systemctl enable ssh
sudo systemctl start ssh

bash

To leave the display of the SSH service status and return to the command prompt, just press the « Q » key to « leave ».

Step 4: Open the SSH port

In order for remote access via SSH to your Ubuntu 24.04 system works, the system must be « accessible from the outside », that is to say that The good network port must be open. By default, SSH uses Port 22. As long as the latter is blocked by the firewall, any connection request fails.

Ubuntu uses a tool called UFW (A Completed Firewall) to control the internal firewall. To prevent SSH connections from being blocked and you don't have to resolve SSH errors later, it is necessary to configure a Explicit authorization for port 22. It is only this rule defined that remote access with tools like putty or other SSH customers can be successfully established. The order to configure this authorization is as follows:

Image: screenshot of the command to update the firewall
The opening of the SSH port is also done by ordering in the Ubuntu terminal.

Step 5: Configuration

OpenSSH's default parameters already offer a solid base for secure distant access under Ubuntu 24.04. However, if you have specific safety or network structure requirements, you can adjust the behavior of the SSH server. It is therefore possible to modify the standard 22 port, to activate or deactivate specifically IP addresses or to prohibit the transfer of connections (TCP Forwarding) according to the needs of your environment.

All the relevant options can be found in the central configuration file called sshd_configwhich allows you to control the SSH demon. To change this file, simply open it with the editor of your choice. We opted for the editor VIM, so the order is as follows:

sudo vim /etc/ssh/sshd_config

bash

Image: screenshot of the SSHD_Config file
You can customize the content of the OpenSSH SSHD_CONFIG configuration file in an editor of your choice, like VIM.

Now make the desired changes in the configuration file, for example by adjusting the ports, restricting authorized protocols or defining secure authentication methods. Make sure you save your changes before closing the publisher.

For the new parameters to take effect, the SSH service must be restarted. This is done with the next order in the terminal:

sudo service ssh restart

bash

Advice

The SSH configuration is particularly useful, for example, if you want to operate an FTP server under Ubuntu. This is the basis for using SFTP, the secure alternative to the classic FTP, integrating by default the encryption and protection of your data.

Backup Cloud by Acronis

Protect your devices and reduce downtime

  • Automatic backup and easy catering
  • Intuitive management and planning
  • Protection against threats based on AI

Télécharger notre livre blanc

Comment construire une stratégie de marketing digital ?

Le guide indispensable pour promouvoir votre marque en ligne

En savoir plus

Web Marketing

Localhost: how to connect to 127.0.0.1?

When you call an IP address, you are usually trying to contact another computer on the Internet. However, if you call the IP address 127.0.0.1,

Web Marketing

What is Proxmox? – IONOS

Proxmox is an open source platform dedicated to virtualization and containerization. It allows you to manage and operate virtual machines, containers and high availability clusters.

Souhaitez vous Booster votre Business?

écrivez-nous et restez en contact