In Ubuntu system, root user account is disable by default for improve security of system. At the installation time of Ubuntu Linux the root user is creating automatically but not asking to set password for root user. In Linux, a user account without password or empty password is considered as a disabled account. This tutorial outlines how to enable and disable root user account in Ubuntu Linux.
We are strongly recommend to only use the sudo user account instead of enabling root account. You can perform all the operations using sudo enabled user account.
Generally, a regular Ubuntu user can perform administrative tasks by granting administrative privileges known as sudo. Sudo enabled users are authorized to perform same as root user account.
To grant a sudo access to a normal user you just have to make member of sudo group. In Ubuntu, members of sudo group have permission of sudo access. By default, initial created user is already member of sudo group so that user have sudo access.
If you want to create a sudo user on your Ubuntu system follow this tutorial.
Enable Root User Account in Ubuntu
To enable the root user you just have to set password for root user. You can set password for a user account using passwd command. As a initial user account you should have sudo privileges to change password of another users. Run the below command:
sudo passwd root
After that, It will prompt you to enter password and confirm password for root user account as given below:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
It’s strongly recommend that you set strong and unique password. It is a most important security aspect of your system. Your password should have at least 14 characters and contains one uppercase letter, one lowercase letter, one number, and one special character.
Finally, you have successfully enabled the root account by setting up password. Now you can login as root user on your Ubuntu server.
Disable Root User Account in Ubuntu
If you have enable root user account on your Ubuntu system and want to disable then simply set the password to expire. Execute the below command:
sudo passwd -l root
In this guide, you have learned how to enable and disable root user account in Ubuntu system.
If you have any more questions or suggestion please write down at comment box.
Leave a Reply