Image

Knowledge base → root access via SSH on Linux Debian

[Virtual servers]
Date of publication: 13.03.2024

When installing the Linux Debian operating system, you will be asked to set a password for the root user, as well as create a new user and specify a password for it.

Once the installation is complete, the server will reboot and offer SSH login. By default, you will not be able to log in as the root user, since this is prohibited in the service configuration files.

You need to log in under the created user and then impersonate the root user by executing the command and specifying the password specified during installation:

user@My-server:~$ su -
Password:

After successful login you will see:

root@My-server:~#

This means that you have successfully logged in as root and have all rights available to you.

To be able to immediately log in via SSH as root, you must enable SSH services in the configuration file.

nano /etc/ssh/sshd_config
PermitRootLogin yes

Let's restart the service to apply the changes:

service sshd restart

Now you can immediately log in to SSH as root, bypassing a regular user.

Remember that by adding convenience, you reduce security, since these two qualities (convenience and safety) are opposite to each other. While this is quite normal at a local stand, on a production server on the Internet it is completely unacceptable.





No Comments Yet