Tutorial to learn the steps to install and enable SSH server in Debian 11 Bullseye Linux using command line terminal. SSH is a network protocol originally developed in 1995 by Finn Tatu Ylönen for encrypted access to other computers in an IP network.
What is SSH in Linux?
SSH is the abbreviation for Secure Shell. With the help of this protocol, the user can securely establish connections with other devices, for example from a PC to a web server. SSH enables mutual authentication and encrypted data transmission so that sensitive data such as passwords or user names cannot be hacked or seen by unauthorized persons. Secure Shell offers a high level of security. It provides functions for logging in, transmitting and executing text-based commands, and for copying data. In addition to encryption, SSH offers reliable mutual authentication using certificates and public and private key procedures. A popular area of application for Secure Shell is the remote maintenance of servers.
Steps to install and enable SSH on Debian 11 Bullseye server
1. Refresh APT cache
Well, first refresh the APT cache so that the system could recognize any recent updates available to download and install or cache.
sudo apt update
2. Install OpenSSH Server on Debian 11
Next, use the APT package manager and install the OpenSSH server on Debian 11 that you want to access remotely using this protocol. The packages to install it are already in the system’s default repo, hence, nothing to do except running of the given command.
sudo apt install openssh-server
3. Check the SSH server service status
Once the installation is completed, the system will automatically start and enable the service of the SSh server. We can confirm the same using:
systemctl status sshd
However, if it is not actively running on your system, then run:
sudo systemctl enable --now sshd
Whereas to stop and restart the service, commands are:
sudo systemctl start sshd sudo systemctl restart sshd sudo systemctl stop
4. Allow port 22 or SSH in the firewall
If you have an active firewall on Debian 11 then also whitelist the port in it to let the system accept the public connections over port number 22.
sudo ufw allow ssh
Those interested in having a UFW firewall can refer to this article:
5. Connect to Debian 11 using SSH
First, find out the remote Debian 11 server or desktop IP address where you have installed the OpenSSH. For that use:
Note down the IP address and move to the local system or the one from where you want to access the remote Debian 11 system.
If you are using Windows then ssh is already there whereas Linux users may need to install an SSH client. Debian/Ubuntu users can go for-
sudo apt install openssh-client where RHEL based Linux (CentOS, Rocky, Alma, Fedora)-
sudo dnf install openssh-client
Now, on your system run:
In the above command replace the
user with the one you have on your remote Debian 11 or any other system that you want to connect over SSH and
server-ip-address with the address of where you have OpenSSH-server installed.
For example– our Debian 11 IP address is 192.168.1.44 and user – h2s and to connect from Windows or Linux using terminal the command will be in this way.
Once the connection is established the system will ask you to accept the ECDSA key fingerprint. Just type yes and hit the Enter key.
The authenticity of host '192.168.1.44 (192.168.1.44)' can't be established. ECDSA key fingerprint is SHA256:6QRijBGfGDd1UiYOBeCEQ7Hx4oW453mEn8OO/Xm6RLk. Are you sure you want to continue connecting (yes/no/[fingerprint])?
After that enter the password for the user you want to connect on the remote system using ssh. In short the password of the user you have mentioned in the SSH command.
In this way, we can connect any Debian 11 Bullseye remotely using SSH running locally or remotely on Cloud or some hosting service.
6. For SSH GUI client on Debian 11- Use PuTTY
Those who want some kind of graphical user interface SSH client on Linux to connect and manage remote servers can go for the popular PuTTY SSH GUI client on Debian 11 or 10. Learn the way to install it.