How to Enable or Disable Root User in Linux
If you want to deactivate the user with root permissions of your Linux System, be it the distro that is, this tutorial teaches you how to do it.
All those who have managed and used computers with a Linux distro, called Fedora, Debian, Ubuntu, etc., we know the importance and scope of the root user within the system since this user has the power to administer the system Operational without any restriction adequately.
This is important for our roles as administrators, but it can be one that can become dangerous for the entire infrastructure if it is manipulated in the wrong way by people without authorization or the necessary knowledge.
We know that in some Linux distros a user can not access to be a root user, so we must prefix the sudo term so that the command we are running can be processed correctly, but some tasks must be executed exclusively as root and not only with sudo.
Today we will see how we can eliminate this root user from our Linux environments to avoid this kind of inconvenience.
How to remove the password of the root user in Linux
To perform this process we must change the user with whom we have logged in to the root user, for this, we execute the following command and enter our administrator password.
Once we are as root users we must execute the following command to remove the root password :
passwd -lock root
This command will allow us to completely disable the access to the root user, to verify it we will try to enter as root user entering our password and we will see the following:
Another security option that we can use with the root user is to modify his current password using the command:
passwd -d root
Enable the root user in Linux
If after all this process we need to use the root user again we can enable it back in the system using the following command:
sudo passwd root
In the expanded window we must establish a password for the root user.
We have seen how we can obtain this security advantage by disabling the root user, but we must do this if necessary since if many users do not access our system or we know that the people who access are trusted and authorized, it is not required to execute this task. If we still need it again, you’ve seen how easy it is to re-enable this root user.
Linux is not the only system where the root superpowers are used and Android is an example. Perhaps you have also seen yourself in the situation of having to disable the root user in Android, and here you will see an easy way to do it.