# How to enable SSH with OpenSSH on Ubuntu 24.04

If you didn’t enable the OpenSSH server during the Ubuntu 24.04 installation, don’t worry! You can easily activate it later. Simply install OpenSSH via the **Terminal** and adjust the SSH configuration to suit your security requirements.

## How to enable SSH on Ubuntu 24.04 step by step

The [SSH protocol](https://www.ionos.com/digitalguide/server/tools/ssh-secure-shell/) is now a standard for secure access to remote servers or computers. It not only ensures encrypted data transmission but also protects against unauthorized access and tampering. In modern Linux systems like [Ubuntu](https://www.ionos.com/digitalguide/server/know-how/ubuntu-the-linux-system-for-everyone/) 24.04, the **open-source solution OpenSSH** is typically used for this purpose.

Note When setting up a [server with Ubuntu](https://www.ionos.com/digitalguide/server/configuration/ubuntu-server/), 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](https://www.ionos.com/digitalguide/server/know-how/sftp-ssh-file-transfer-protocol/) and [SCP](https://www.ionos.com/digitalguide/server/know-how/scp-secure-copy/). Since the SSH service is not automatically active in Ubuntu after installation, it needs to be set up first. [Creating your own SSH keys on Ubuntu](https://www.ionos.com/digitalguide/server/configuration/generate-ssh-key-ubuntu/) can also be done in a few steps.

Learn how to set up OpenSSH on Ubuntu 24.04 and discover the available configuration options in this step-by-step guide.

### Step 1: Open terminal

First, open the **command line tool** of your [Linux distribution](https://www.ionos.com/digitalguide/server/configuration/linux-distributions/). There are several ways to do this. Either by right-clicking on the desktop &gt; **Open in Terminal** and using the shortcut **\[Ctrl\] + \[Alt\] + \[t\]**, or by opening the applications menu and using the search function. Just type “Terminal” in the search field.

[![Image: Screenshot of the Ubuntu app searc](https://www.ionos.com/digitalguide/fileadmin/_processed_/c/3/csm_ubuntu-24-terminal-search_1680a51bb2.webp "Screenshot of the Ubuntu app searc")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2025/ubuntu-24-terminal-search.jpg) 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](https://www.ionos.com/digitalguide/server/configuration/linux-sudo-command/) as the root user. The following terminal command starts the installation:

```bash
sudo apt install openssh-server
```

[![Image: Screenshot of the installation of OpenSSH in the terminal](https://www.ionos.com/digitalguide/fileadmin/_processed_/4/8/csm_ubuntu-24-ssh-install_ad318da74a.webp "Screenshot of the installation of OpenSSH in the terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2025/ubuntu-24-ssh-install.jpg) The OpenSSH installation simply takes place in the Ubuntu terminal. Since you are acting as a superuser, you need to enter your password before the installation and confirm this entry by pressing Enter.

### Step 3: Verify success

Once the installation is complete, verify its success by checking the status of your SSH daemon. Do so easily via the terminal using the following command:

```bash
sudo systemctl status ssh
```

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](https://www.ionos.com/digitalguide/fileadmin/_processed_/f/9/csm_ubuntu-24-ssh-status_f0d4a249b1.webp "Screenshot of the status of SSH in the terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2025/ubuntu-24-ssh-status.jpg) 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:

```bash
sudo systemctl enable ssh
sudo systemctl start ssh
```

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 “accessible from external sources”. More specifically: **The correct network port must be open.** By default, SSH runs over port 22. As long as this is blocked by the firewall, every connection request will be unsuccessful.

Ubuntu uses a tool called UFW (Uncomplicated Firewall) to control the internal [firewall](https://www.ionos.com/digitalguide/server/security/what-is-a-firewall/). To ensure SSH connections are not blocked and you don’t have to [fix SSH errors](https://www.ionos.com/digitalguide/server/know-how/fixing-ssh-errors/) later, you need to set up an **explicit allowance for port 22**. Only once this rule is set can remote access be successfully established with tools like PuTTY or other SSH clients. The command to set up this allowance is as follows:

```bash
sudo ufw allow ssh
```

[![Image: Screenshot of the command to update the firewall](https://www.ionos.com/digitalguide/fileadmin/_processed_/0/e/csm_ubuntu-24-firewall-update_e413cd443c.webp "Screenshot of the command to update the firewall")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2025/ubuntu-24-firewall-update.jpg) The SSH port release is also carried out using a command in the Ubuntu terminal. ### Step 5: Make configuration changes

The default OpenSSH settings already provide a solid foundation for secure remote access on Ubuntu 24.04. However, if you have specific requirements for security or network structure, you can customize the SSH server’s behavior. For instance, you can change the default port 22, selectively enable or disable [IP addresses](https://www.ionos.com/digitalguide/server/know-how/what-is-an-ip-address/), or disable connection forwarding ([TCP](https://www.ionos.com/digitalguide/server/know-how/introduction-to-tcp/) forwarding) depending on what your environment requires.

All relevant options can be found in the central configuration 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](https://www.ionos.com/digitalguide/server/tools/linux-editor-effective-code-editing-with-vim/), so the command is as follows:

```bash
sudo vim /etc/ssh/sshd_config
```

[![Image: Screenshot of the sshd_config file](https://www.ionos.com/digitalguide/fileadmin/_processed_/d/4/csm_ubuntu-24-ssh-config_5a12d2ba5c.webp "Screenshot of the sshd_config file")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2025/ubuntu-24-ssh-config.jpg) You can customize the content of the OpenSSH configuration file sshd\_config in an editor of your choice, such as vim. Now make the desired changes to the configuration file—such as adjusting ports, restricting allowed protocols, or setting secure authentication 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:

```bash
sudo service ssh restart
```

Tip Configuring SSH is particularly useful if you want to run an [FTP server on Ubuntu](https://www.ionos.com/digitalguide/server/configuration/ubuntu-ftp-server-installation-and-configuration/). This setup lays the groundwork for using SFTP—the secure alternative to traditional FTP, with encryption and data protection already built in.


This is a markdown version of: [https://www.ionos.com/digitalguide/server/configuration/ubuntu-2404-ssh/](https://www.ionos.com/digitalguide/server/configuration/ubuntu-2404-ssh/) for AI/LLM consumption.