SSH (Secure Shell) is a network protocol that allows users to remotely access, control, and transfer files and other data. It ensures protected communication between two computers by encrypting the connection and safeguarding sensitive information. More specifically, SSH is primarily used for secure file transfers, system monitoring, and tasks requiring a secure communication channel.
This guide will cover the installation and configuration process of SSH and will also let you know how to enable SSH root login on Debian 12.
So, let’s begin!
1. Installing SSH on Debian 12
Firstly, install SSH to provide secure access and manage and configure the server remotely by using the following command:
sudo apt install openssh-server

Next, install the SSH client with:
sudo apt install openssh-client
2. Configuring SSH on Debian 12
Configuring SSH is important for secure remote access to your server. This setup allows you to securely connect to your server remotely and make sure that your management and communication are protected.
So, start by checking the status of SSH by utilizing the below command:
sudo systemctl status ssh
In case SSH is not enabled, then enable it using:
sudo systemctl enable ssh
After enabling it, start the SSH service with the command:
sudo systemctl start ssh
This command starts SSH and allows you to connect server remotely:
3. Configuring SSHD on Debian 12
SSHD (SSH Daemon) is the server-side program that handles SSH connections. By configuring the SSHD, you can control many settings to manage, such as root login permissions. This ensures that remote access is secure and aligns with your server’s security policies.
Now, check the SSHD status to ensure that it is enabled through:
sudo systemctl status sshd
To enable and start the SSHD service, use the below command:
sudo systemctl enable sshd
sudo systemctl start sshd
4. Enabling SSH Root Login on Debian 12
If you want to use a Debian root account by SSH, you will get a permission error. To resolve it, first open the SSH configuration file with:
sudo nano /etc/ssh/sshd_config
Then paste the below line as indicated in the given image:
PermitRootLogin yes
Now, refresh the SSHD service to make sure that the updates have taken effect:
systemctl restart sshd
Conclusion
In this guide, we have covered the installation and configuration process of SSH. We have also looked at how to enable SSH root login on Debian 12.
By installing and setting up the SSH server and client and adjusting settings such as enabling root login, you can enhance your server management’s security and flexibility.
Frequently Asked Questions
/etc/ssh/sshd_config
) and set PermitRootLogin
to yes
, then restart the SSH service using systemctl restart sshd
. PermitRootLogin
directive in /etc/ssh/sshd_config
back to no
or prohibit-password
, then restart the SSH service.