In Debian 12 and many other modern Linux distributions, the root login via SSH is disabled by default for security reasons. However, if you have a specific need to enable root login, you can follow these steps:
Step 1 : Connect to your Debian 12 server using an SSH client such as PuTTY or the terminal.
Step 2 : Open the SSH server configuration file in a text editor with root privileges. You can use the following command to open the file with the nano
text editor:
Step 3 : Locate the line that begins with #PermitRootLogin
and remove the #
symbol at the beginning of the line to uncomment it.
Step 4 : Modify the line to allow root login by changing the value after PermitRootLogin
to yes
:
Step 5 : Save the changes and exit the text editor (in nano, press Ctrl + O
to save and Ctrl + X
to exit).
Step 6 : Restart the SSH service to apply the changes:
Enabling root login via SSH is generally discouraged for security reasons. It is recommended to use SSH key-based authentication and log in as a regular user with sudo privileges instead. If you need administrative access, you can use the sudo
command to execute commands as root when necessary.