# How to enable and install Ubuntu SSH

If you didn’t enable the default OpenSSH server during the initial Ubuntu installation, you can add it at any time. Once OpenSSH is installed via the terminal, you can also adjust the Ubuntu SSH daemon’s configuration to suit your needs.

## How to install Ubuntu SSH server step by step

To enable secure remote access to a computer or server, [SSH](https://www.ionos.com/digitalguide/server/tools/ssh-secure-shell/) (**S**ecure **Sh**ell) is essential. This security protocol incorporates three core elements that protect remote connections:

- **Authentication** of the remote endpoint ensures that you never contact the wrong party (whether client or server).
- **Encryption of data transmission** prevents unauthorized parties from reading the information.
- **Ensuring data integrity** makes transmitted data tamper-proof.

Linux distributions such as [Ubuntu](https://www.ionos.com/digitalguide/server/know-how/ubuntu-the-linux-system-for-everyone/) have long relied on the open-source OpenSSH suite to use SSH and to enable secure file transfers via [SCP](https://www.ionos.com/digitalguide/server/know-how/scp-secure-copy/) or [SFTP](https://www.ionos.com/digitalguide/server/know-how/sftp-ssh-file-transfer-protocol/).

By default, OpenSSH is **not enabled in a fresh Ubuntu installation**, which means you first need to enable Ubuntu SSH. Below, you’ll learn how to do this step by step and which configuration options are available once the Ubuntu SSH server is running.

Note If you set up an [Ubuntu server](https://www.ionos.com/digitalguide/server/configuration/ubuntu-server/) and use the Ubuntu Server Edition for this purpose, you’ll have the option to enable Ubuntu SSH during installation.

### Step 1: Open the terminal

To install Ubuntu SSH via `install` or enable it, you’ll need the terminal—the Linux distribution’s **command-line tool**. Your first step is therefore to open this handy administration tool. The easiest way to do this is by using the keyboard shortcut **\[Ctrl\] + \[Alt\] + \[t\]**.

Alternatively, you can start the terminal via the “Show Applications” menu by clicking the button of the same name and using the search function to look for “terminal”.

[![Image: Ubuntu search function: Search for “terminal”](https://www.ionos.com/digitalguide/fileadmin/_processed_/3/4/csm_ubuntu-search-function-search-for-terminal_26b00d9051.webp "Ubuntu search function: Search for “terminal”")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/ubuntu-search-function-search-for-terminal.png) Ubuntu search function: Search for “terminal”  Tip Do you want to set up secure SSH connections to a server or service? [Create your SSH keys in Ubuntu](https://www.ionos.com/digitalguide/server/configuration/generate-ssh-key-ubuntu/) yourself in just a few steps.

### Step 2: Install the Ubuntu SSH service

With the Ubuntu `install` command for the SSH service, you can now install Ubuntu SSH (OpenSSH) in the command-line tool you opened. The command is as follows:

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

[![Image: OpenSSH installation in the Ubuntu terminal](https://www.ionos.com/digitalguide/fileadmin/_processed_/a/9/csm_openssh-installation-in-the-ubuntu-terminal_be573817fd.webp "OpenSSH installation in the Ubuntu terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/openssh-installation-in-the-ubuntu-terminal.png) OpenSSH installation in the Ubuntu terminal Enter your user password and confirm it by pressing Enter to start installing the Ubuntu SSH service.

Tip Installing OpenSSH differs only slightly across the various Ubuntu versions. You can use the method described to install Ubuntu SSH both on [SSH on Ubuntu 24.04](https://www.ionos.com/digitalguide/server/configuration/ubuntu-2404-ssh/) and on older editions.

### Step 3: Check the status and enable the Ubuntu SSH server if needed

After installing Ubuntu SSH, you can use the following command to check whether the SSH daemon is running as expected:

```bash
sudo systemctl status ssh
```

In the command output, the Ubuntu SSH service is running if you see the status “active (running)”. To ensure SSH is also available after every system reboot, the “Loaded” line should additionally show “vendor preset: enabled”.

[![Image: Terminal output for the OpenSSH status check](https://www.ionos.com/digitalguide/fileadmin/_processed_/8/6/csm_terminal-for-openssh-status-query_47b22c3f6e.webp "Terminal output for the OpenSSH status check")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/terminal-for-openssh-status-query.png) Terminal output for the OpenSSH status check If the **SSH service is still inactive** and automatic startup on reboot isn’t enabled either, you can change this by entering two additional commands:

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

Press “q” to exit the SSH status output and return to the command line prompt.

### Step 4: Open the SSH port

To be able to connect to your Ubuntu system from anywhere via Ubuntu SSH, the **network protocol port** (default: TCP port 22) must also be open. Only then can you successfully establish a **remote connection** with SSH clients like PuTTY.

Ubuntu includes UFW, its own configuration tool for the built-in firewall. Set up a corresponding rule in this tool for **SSH communication** so that the port is open for incoming and outgoing data:

```bash
sudo ufw allow ssh
```

[![Image: Opening the SSH port via the Ubuntu terminal](https://www.ionos.com/digitalguide/fileadmin/_processed_/d/2/csm_enabling-ss-port-with-ubuntu-terminal_19e4fdaa7c.webp "Opening the SSH port via the Ubuntu terminal")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/enabling-ss-port-with-ubuntu-terminal.png) Opening the SSH port via the Ubuntu terminal  Tip A closed port is often the reason SSH connections fail. There are also several other **possible issues** that can prevent secure SSH connections from being established. In general, you can [fix SSH errors easily](https://www.ionos.com/digitalguide/server/know-how/fixing-ssh-errors/) if you’re familiar with the most common causes.

### Step 5: Configure the Ubuntu SSH server

The default OpenSSH configuration is already well suited for secure remote connections to your Ubuntu system. However, you can **adjust the standard settings** if you want to change the communication port, define a specific Internet Protocol version, or disable TCP forwarding.

All SSH-related settings for Ubuntu are managed in the central configuration file `sshd_config`. To apply changes, open this file using a text editor of your choice (for example, *nano*) as shown below:

```bash
sudo nano /etc/ssh/sshd_config
```

[![Image: Contents of the OpenSSH configuration file sshd_config](https://www.ionos.com/digitalguide/fileadmin/_processed_/6/3/csm_contents-in-openssh-configuration-file-sshd-config_780126a5f9.webp "Contents of the OpenSSH configuration file sshd_config")](https://www.ionos.com/digitalguide/fileadmin/DigitalGuide/Screenshots_2022/contents-in-openssh-configuration-file-sshd-config.png) Contents of the OpenSSH configuration file sshd\_config Adjust the **contents of the configuration file** to your needs and save your changes before closing it. Then **restart OpenSSH** so the changes take effect:

```bash
sudo service ssh restart
```

Tip Setting up Ubuntu SSH is worthwhile, especially if you plan to use an [Ubuntu FTP server](https://www.ionos.com/digitalguide/server/configuration/ubuntu-ftp-server-installation-and-configuration/). This allows you to offer the secure FTP alternative SFTP mentioned earlier.


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