Table of Contents
This tip is about the how to Configure and Turn on SSH on Debian 11 Bullseye Linux. So read this free guide, How to Configure and Turn on SSH on Debian 11 Bullseye Linux step by step. If you have query related to same article you may contact us.
How to Configure and Turn on SSH on Debian 11 Bullseye Linux – Guide
This tutorial exercise shows the best way to install and organize the SSH server on Debian 11, so that clients can remotely join without password by verification keys. SSH, representing Secure Shell, is an organization’s convention for remote login and information movement. OpenSSH (also known as OpenBSD Secure Shell) is an SSH fork that can be accessed from the Linux, macOS and Windows warehouses themselves.
Enable SSH on Debian
To install and enable SSH on Debian, complete the following steps: Open your terminal, update your Debian system:
$ sudo apt update
The SSH server is not installed by default on the Debian system. To install it, use the openssh-server package, which is available in the Debian archive. To install SSH, type:
$ sudo apt install server openssh
Enter the sudo user password when prompted and enter Y to continue with the installation. Verify the installation by running the following command:
$ sudo systemctl status ssh
The SSH service will automatically start and show up (running) to confirm. Press q to exit, back to shell. If it does not start, use the following command to start the ssh service:
$ sudo systemctl start ssh
To enable the ssh service at system startup, type:
$ sudo systemctl enable ssh
Find Your Server IP You can use different methods to find the IP address assigned to your Linux system. You can simply issue the following command to get your server’s IP address:
$ip to
1: lo: mtu 65536 qdisc noqueue UNKNOWN state qlen 1000link / loopback group default 00:00:00:00:00:00 brd 00:00:00:00:00:00inet 127.0.0.1/8 host scope lovalid_lft forever preferred_lft foreverinet6 :: 1/128 scope hostvalid_lft forever preferred_lft forever2: eth0: mtu 1500 qdisc mq state UP default group qlen 1000link / ether f2: 3c: 92: e8: 9f: cc brd ff: ff: ff: ff: ff: ffinet: ffinet 192.168.0.64/24 brd 192.168.0.255 dynamic global scope eth0valid_lft 48927sec preferred_lft 48927secinet6 2600: 3c :: f03c: 92ff: fee8: 9fcc / 64 dynamic global scope mngtmpaddr noprefixroutevalid_lft 2592000sec preferred_lft 604800secinet6 fe80 :: f03c: 92ff: fee8: 9fcc / 64 scope linkvalid_lft forever preferred_lft forever
On the output you can see that the IP address of the system is 192.168.0.64.
Connect to your server using SSH
By default, all Linux distributions have an ssh client installed. This allows the client machine to connect to the server using ssh. Use the following ssh command to login to the remote machine:
ssh linoxide@192.168.0.64
Exit:
The authenticity of host ‘192.168.0.64 (192.168.0.64)’ cannot be established. The ECDSA key fingerprint is SHA256: kuEUb8Lpus1yPuKJ6fm8s9E8x61wGv1u6U2OhEb3Ubc. Are you sure you want to continue connecting (yes / no /[fingerprint])? Y
This message is displayed when you connect to the remote host for the first time. Press yes to continue.
Warning: Permanently added ‘192.168.0.64’ (ECDSA) to the list of known hosts.linoxide@192.168.0.64 password:
Enter your user password to login. You get the following standard welcome message followed by a shell prompt. Great, you are safely logged into Debian.
Linux debian-host-01 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_6The programs included with the Debian GNU / Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.Debian GNU / Linux comes ABSOLUTELY NO WARRANTY, to the extent
firewall settings
UFW is the popular user-friendly interface for iptables firewall. UFW is not installed by default on Debian.
To install ufw on Debian, type:
$ sudo apt install ufw
By default, the UFW is configured to deny all incoming connections and allow all outgoing connections. Before enabling UFW, enable ssh, otherwise it would deny incoming connections. By default, the SSH daemon uses port 22. For security enhancement, you can change the default port or set up port forwarding.
To allow port 22 using ufw, enter:
$ sudo ufw allow 22
To enable UFW, type:
$ sudo ufw enable
The firewall is now active, with a firewall rule to allow SSH connections.
Disable SSH
You can simply stop the ssh service to disable SSH in Debian.
$ sudo systemctl stop ssh
To disable ssh at system startup, type:
$ sudo systemctl disable ssh
Final note
I hope you like the guide How to Configure and Turn on SSH on Debian 11 Bullseye Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.