Secure Shel allows you to handle your network service to control any unsecured situations. On Linux and Unix like Operating Systems, the root user act as a superuser who can do many things that an ordinary user cannot. To connect to your system remotely and do the administrative tasks you need to log in as a root user. In this article, you will learn How to Enable Root Login Via SSH In Debian 10. If you are preparing to buy your own Linux VPS, visit the available packages of Eldernode to purchase the best.
To let this tutorial work better, please consider the below Prerequisites:
A non-root user with sudo privileges.
To set up, follow our Initial Setup with Debian 10.
Table of Contents
Tutorial Enable Root Login Via SSH In Debian 10 | Debian 9
Debian Linux does not allow to log in to the server as a root user via the SSH protocol and has been disabled from the main ssh configuration file by default. So, you will receive an error message (Due to security reasons) while you are trying to log in as a root user. The error message is ”Permission denied, please try again’. Join us with this article to review the process of enabling root login via ssh.
Loggin as root
When you log in with the root account, you are a special user with administrative rights. However, you must be ensured of your knowledge about commands you run since any careless or malformed command will make the entire operating system unusable. That’s why security reasons do not allow you to log in as root and you need to enable it. On Debian, it is originally enabled as a security precaution which means that you cannot directly log in as a root user over SSH.
Allow SSH root login on Debian
Since the PermitRootLogin parameter controls the ssh root permission, you must change its values. The parameter is /etc/ssh/sshd_config and the value of the PermitRootLogin is ”without-password”. So, you need to ser PermitRootLogin to yes to Permit root login.
How to Enable root login over SSH
In the following, you can review the required simple steps of this guide. In this way, you can change the disabled default mode to enable and log in via SSH.
Open the ssh configuration file and use your favorite text editor.
nano /etc/ssh/sshd_config
Then, Search for PermitRootLogin and change its value to “Yes”. If the line exists and is commented out with a ”#”, remove the ”#”.
PermitRootLogin yes
Now, you can save the updated /etc/ssh/sshd_config file and restart the SSH server. Use the command below to do this:
systemctl restart sshd
that’s that, if you do not see any new error, you should be able to access your Debian server using the root user account via SSH protocol.
Conclusion
In this article, you learned How to Enable Root Login Via SSH In Debian 10. As you know, by default SSH root login is disabling in Debian since it is not recommending to use the root password via ssh. So, you can ssh to the server as a regular Linux user and then use the su command to login as the root user. In case you are interested in reading more, find our related articles on Install SSH Server on Linux and allow root user login.
Don’t forget to add ssh key to your root user, and to deny shell in your .ssh/authorized_keys
Thank you for your comment.
How the hell I can save this file if i’m NOT root, guess why I am trying to enable ROOT in first place? This linux shit is killing me.
Debian does not allow to log in to the server as a root user via the SSH protocol and has been disabled from the main ssh configuration file by default.
work perfectly
Thanks for your comment.