Cyberithub

How to Install OpenSSH Server on Debian 11

Advertisements

In this article, I will take you through the steps to install OpenSSH Server on Debian 11. You might have faced a situation where you have a freshly installed Debian 11 System and when you were trying to remotely connect your Server using SSH port then it is getting timed out and you are unable to connect. When you tried to check the root cause of this issue then you found that it is because of openssh-server package not installed in your System.

So now you need to install OpenSSH Server packages on your System to bring up the ssh service and open Port 22 for incoming connections. To do this you need to follow some simple steps I have mentioned in below section. More about OpenSSH Server.

How to Install OpenSSH Server on Debian 11

Steps to Install OpenSSH Server on Debian 11

Also Read: How to Install Jsonnet on Ubuntu 20.04 LTS{Easy Steps}

Step 1: Prerequisites

a) You should have a running Debian 11 System.

b) You should have sudo or root access to run privileged commands.

c) You should have apt and systemctl command available in your Server.

 

Step 2: Update Your Server

In the first step you need to update your Server by using apt update or apt-get update command as shown below. This command will download and install all the latest updates from the Debian Repository.

How to Install OpenSSH Server on Debian 11 2

 

Step 3: Install OpenSSH Server

Once updated you can now install openssh-server package using apt install openssh-server or apt-get install openssh-server command. This command will download and install openssh-server package along with its dependencies from Debian Repository as you can see below.

How to Install OpenSSH Server on Debian 11 3

 

Step 4: Verify Installed Package

You can verify the installed package by querying the package name from the list of installed package using dpkg-query -l | grep -i openssh-server command as shown below.

root@debian:~# dpkg-query -l | grep -i openssh-server
ii openssh-server 1:8.4p1-5 amd64 secure shell (SSH) server, for secure access from remote machines

 

Step 5: Check OpenSSH Version

You can use ssh -V command to check the OpenSSH version as shown below. As you can see here installed version is 8.4.

root@debian:~# ssh -V
OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1k 25 Mar 2021

 

Step 6: Check SSH Service

You can check the ssh service status by using systemctl status sshd command as you can see below. If it shows active and running then it means ssh service is up and now you can try connecting Server using ssh port.

root@debian:~# systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: e>
Active: active (running) since Mon 2021-09-27 01:15:39 PDT; 3min 36s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 461 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 483 (sshd)
Tasks: 1 (limit: 2325)
Memory: 4.7M
CPU: 103ms
CGroup: /system.slice/ssh.service
└─483 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups

If you want to restart ssh service then you can use systemctl restart sshd command.

systemctl restart sshd

Similarly if you want to stop or start ssh service then you can use systemctl start sshd or systemctl stop sshd command.

 systemctl start sshd
 systemctl stop sshd

 

Step 7: Test Your SSH Connection

Finally to test your SSH Connection, you can try connecting Debian Server through putty software by using Server IP Address and SSH Port 22 as you can see below. Since my Debian Server is having an IP Address of 192.168.29.108 so I am giving this IP and selecting SSH protocol to connect. Then I will just Click on Open. If there are no other SSH issues then we should be able to connect and then it will ask for Username and password to authenticate. Once you provide that it will login successfully.

How to Install OpenSSH Server on Debian 11 4

 

Step 8: Remove OpenSSH Server

Once you are done with the SSH Service, you can also remove it by simply using apt remove openssh-server or apt-get remove openssh-server command.

root@debian:~# apt-get remove openssh-server

4 thoughts on “How to Install OpenSSH Server on Debian 11”

    • Hi Dopasc,

      Thanks for your valuable feedback.
      You are absolutely correct. openssh-server is included in bullseye but this post is more focused for those folks who still does not find openssh-server package in their Debian System due to some xyz reason.

      Reply

Leave a Comment