How To Enable Root SSH Login In Linux For Debian 12

    Posted: (UTC)
How To Enable Root SSH Login In Linux For Debian 12 Image

Introduction

In this tutorial you will learn how you can enable SSH Login for Root in Debian 11. We do not recommend using the root user for the startup script that runs the Rust server. However, in some cases, you may need root access, for example, if you want to install SteamCMD. By default when you install debian, you create Two Users:

  • Root User
  • Regular User

We use SSH to log into the system, such as a VPS, for installing or setting it up. SSH login is a lightweight and fast way to configure your system compared to using a GUI with RDP or other methods. GUIs can sometimes be slow to work with, but SSH is much faster and can be accessed directly from your terminal or command line.

In my case, I'm using a virtual machine for this purpose. The process is the same for any VPS or other service you might use. You will need the username of the account you want to log in to and the IP address. In my case, I'm going to use the IP address of my virtual machine.

Prerequisites:

Here are somethings you should know before following along:

  • Root is an administrator account. System Security depends on it
  • You have to be a Root user to make these changes
  • Basic Knowledge of Linux file commands
  • Use Root for installing apps and services only
  • Set Password Bigger then 8 for Root user
  • SSH can be brute forced so keep your password stronger

The root user is the administrator of the system, and regular users do not have root privileges. SSH works for regular users by default, allowing you to log in to the system using the command line or terminal. However, for the root user, you need to enable the settings by changing PermitRootLogin to Yes in the sshd_config file.

Debian 11 Root Login

Debian does not have a sudo group so we are directly going to use the nano command without sudo. Type the following command to edit the file:

$ nano /etc/ssh/sshd_config

Now you have to scroll down and uncomment the PermitRootLogin line by removing # from its start and replacing No with Yes at the end, as shown in the image below:

Debian 11 SSHD_Config File DataAfter exiting from nano and saving the file, you have to restart the ssh system by using the following command:

$ /etc/init.d/sshd restart

If you want  to disable it again, simply edit the file again and set PermitRootLogin to No or comment it by placing # at the start.

Debian 11 Root SSH Login Success