Remove root Password and Disable root Login on Linux

Shahriar Shovon

Supported OS

  • All

Categories

Share this post with your friends

We set up root password for making our Linux administration life easier. But enabling root login is a security risk. So after we're done setting up our Linux system, we should/can remove root password and disable root login. This is the topic of this post.

Disable root Login

To disable root login or removing root password, run the following command. sudo passwd -l root passwd: password expiry information changed.

Testing:

Now if you try to login as root, you shouldn't be able to login. su - su: Authentication failure

References:

Ubuntu Forums (https://ubuntuforums.org/showthread.php?t=1204751) Tested on: Ubuntu 16.04 LTS