Greenwebpage Community Blog Tutorials How to Enable SSH Root Login on Debian 12: Step-by-step
Tutorials

How to Enable SSH Root Login on Debian 12: Step-by-step

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
Installing SSH

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

SSH root login is disabled by default for security reasons. Allowing root access directly can make your system vulnerable to brute-force attacks.
To enable SSH root login, edit the SSH configuration file (/etc/ssh/sshd_config) and set PermitRootLogin to yes, then restart the SSH service using systemctl restart sshd.
Enabling SSH root login increases the risk of unauthorized access, as attackers can directly target the root account, which has full system privileges.
Yes, you can use a password for root login, but it's recommended to use SSH key authentication for better security, disabling password authentication if possible.
To disable SSH root login, change the PermitRootLogin directive in /etc/ssh/sshd_config back to no or prohibit-password, then restart the SSH service.
Exit mobile version