How to Enable SSH on Debian 13

How to Enable SSH on Debian 13

In this blog post, we will explain how to enable SSH on Debian 13. SSH, or Secure Shell, is a cryptographic network protocol that allows secure remote access and data transfer between servers or computers over an unsecured network. The following blog post will cover the installation of the OpenSSH server, provide some basic SSH commands, and offer an overview of what SSH is, its purpose, and how it works.

Enabling SSH on Debian 13 is a straightforward process that typically takes around 10 minutes to complete. Let’s get started!

What is SSH and How Does it Work?

The Secure Shell Protocol is a method for securely sending commands between two machines over an unsecured network. This protocol uses cryptography to authenticate and encrypt connections between devices. It also allows SSH tunneling and Port forwarding for data packets to cross between networks, which would not be possible without this feature.

The SSH setup establishes encrypted remote connections between a user’s machine (computer) and a remote machine (server). The data between these two is through strong encryption which makes it difficult for outside decrypted data to get access.

SSH tunneling, also known as port forwarding in networking, is a method for transferring packets across a network by encapsulating the data packets to change their destination during the journey from one machine to another.

The remainder of this blog post will focus on the installation and configuration of the OpenSSH server, which is necessary to enable SSH on the Debian 13 operating system.

Prerequisites

Step 1. Update the system

Before we start with the installation of the OpenSSH server, we need to update the packages to their latest available versions. To do that, execute the following command:

sudo apt update -y && sudo apt upgrade -y

Step 2. Install OpenSSH server

OpenSSH is an open-source implementation of the Secure Shell (SSH) protocol. To install OpenSSH, execute the following command:

sudo apt install openssh-server -y

Once installed, start and enable the SSH service:

sudo systemctl start ssh && sudo systemctl enable ssh

To check the status of the server, execute the command below:

sudo systemctl status ssh

If everything is OK, you should receive output similar to this:

root@host:~# sudo systemctl status ssh
● ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/usr/lib/systemd/system/ssh.service; enabled; preset: enabled)
     Active: active (running) since Tue 2025-06-03 03:24:47 CDT; 5min ago
 Invocation: a056fec913714ac9bbdbbb1d2afd4095
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 13210 (sshd)
      Tasks: 1 (limit: 4640)
     Memory: 1.4M (peak: 2M)
        CPU: 94ms
     CGroup: /system.slice/ssh.service
             └─13210 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

Jun 03 03:24:47 host.test.vps systemd[1]: Starting ssh.service - OpenBSD Secure Shell server...
Jun 03 03:24:47 host.test.vps sshd[13210]: Server listening on 0.0.0.0 port 22.
Jun 03 03:24:47 host.test.vps sshd[13210]: Server listening on :: port 22.
Jun 03 03:24:47 host.test.vps systemd[1]: Started ssh.service - OpenBSD Secure Shell server.

Step 3. Configure the SSH Server

As shown in the status of the SSH service, it is listening on port 22. This is the default port number for the OpenSSH server, and to check this, you can use the following command:

netstat -tunlp | grep ssh

You should get the following output:

root@host:~# netstat -tunlp | grep ssh
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      13210/sshd: /usr/sb 
tcp6       0      0 :::22                   :::*                    LISTEN      13210/sshd: /usr/sb

Now, we need to make some changes in the /etc/ssh/sshd_config to enable password authentication and Root Login. To do that, open the /etc/ssh/sshd_config file with your favorite editor and uncomment these lines to look like this:

PasswordAuthentication yes

PermitRootLogin yes

To enhance your server’s security, consider changing the default port 22 to a different port number, such as 7022.

Port 7022

Save the changes, close the file, and restart the SSH service for the changes to take effect.

sudo systemctl restart ssh

Now, the SSH service will listen on port 7022, and to confirm this, you can execute the following command again:

netstat -tunlp | grep ssh

You should get the following output:

root@host:~# netstat -tunlp | grep ssh
tcp        0      0 0.0.0.0:7022            0.0.0.0:*               LISTEN      13642/sshd: /usr/sb 
tcp6       0      0 :::7022                 :::*                    LISTEN      13642/sshd: /usr/sb

Now, we can open port 7022 in the firewall using the iptables:

iptables -A INPUT -s yourserverIP/24 -m state --state NEW -p tcp --dport 7022 -j ACCEPT

To connect to the server via SSH from the command line, you can use the following command:

ssh root@yourserverIP -p 7022

That’s it. You successfully installed and enabled the SSH service on Debian 13 OS.

Of course, you don’t have to install OpenSSH on Debian 13 if you have difficulties and are not familiar with Linux and SSH services. You can always contact our technical support. You only need to sign up for one of our Linux VPS hosting plans and submit a support ticket. We are available 24/7 and will attend to your request promptly.

If you liked this post, “How to Enable SSH on Debian 13”, please share it with your friends or leave a comment down below.

Leave a Comment