In this article, we are going to learn how to get root access on ubuntu using sudo command. By default root account is disabled in Ubuntu for security reasons. But if you want root access then you have to follow this article. Where you will learn how to get root access on Ubuntu using the sudo command .
What is sudo
The sudo command allows the current user to execute a command as the superuser, as specified by the security policy. The sudo is working like root user. Execute the all command who need root privilege.
Get Root Access on Ubuntu
If you want to get root access. You have to sudo privilege, if you are not in the sudoer group you can not get root access. So first of all open the terminal on your Ubuntu. And run the following command in the terminal.
$ sudo -i
After entering the password, you can see the prompt changed to root. Now you are login as root in the terminal.
Set the root Password
Now we have to set the root password. Run the following command in the terminal.
# passwd root
That’s it! You have successfully enabled the root account. You can now log in to your Ubuntu machine as user root using the new password.
Disable Root User Account in Ubuntu
If you previously enabled the root user in Ubuntu and now you want to disable it, set the root password to expire.
To disable the root account password, use the following command:
$ sudo passwd -l root
Conclusion
To enable the root user account in Ubuntu, all you need to do is to set the root password.
When setting the password, make sure you’re using a strong and unique password. Having a strong password is the most important aspect of the security of your account. Often a strong password has at least 16 characters, at least one uppercase letter, one lowercase letter, one number, and one special character.
If you have any questions or feedback, feel free to leave a comment.
Related Linux Tutorials: