Root is often disabled by default when Ubuntu is installed. However, you might find it active when Ubuntu (or other Linux distribution) is deployed in automated environments E.g. when installed with a Virtual Private Server (VPS).
To disable root and administer the system from other user accounts, consider setting up sudo. As root, add a user to sudo that can execute commands as root:
$ sudo adduser trevor sudo
Note that you should replace trevor with a username on your system. Exit the shell as root and login with the username that you just added to sudo (or any other pre-configured sudoer). Use sudo to disable the root password, thus disabling login.
$ sudo passwd -dl root
If you are in a circumstance where you need to enable the root account, type the following while logged in as a sudoer:
$ sudo passwd root
You will be prompted to enter and confirm the password for root.
Read the Ubuntu Official Documentation on RootSudo for additional information and a clear explanation on the benefits of disabling root.
One thought on “Disabling Root User on Ubuntu Server 14.04 LTS”