How To Set/Change Root Password In Ubuntu?
This post was last updated on August 1st, 2020 at 03:37 pm
A root user is a most privileged user account in a Unix based operating system. It has access to all the commands and files of the system. A root user is also called a superuser or administrator because it is needed to perform administrative tasks.
It is used to perform tasks such as installing software, changing the ownership and permissions of files, and managing other user accounts which cannot be done with a normal user account.
Ahead in this article, we will see how we can set/change and disable or remove the password of the root user.
Root account in Ubuntu/Linux Mint
In Ubuntu or a distribution based on Ubuntu, a standard root account is created while the installation of the operating system but no password is assigned to it. Ubuntu comes sudo only by default, which means you are given the ability to execute a task with superuser privileges by using the sudo command. After installing OS If you want you can set or remove the password of the root account by using the terminal.
How to Set/Change the password of root
Since the root account in Ubuntu is created with no password. Use the following steps to assign a password-
1. You can set it in one go by using the following command –
sudo passwd root
This will ask you to enter the new Unix password, enter it and then retype the same password in the next line. Once the password gets assigned it will display a message that password updated successfully.
Now you can check it by using the following command –
It will ask you to enter the root password, enter it. Now you will be logged in as root.
2. Another way to set or change the password of root is –
This will prompt you to enter the user password and then switched to root. Now enter the following command to set/change the password.
Again it will ask you to enter the new Unix password, enter it and then retype the same password in the next line. Once the password gets assigned it will display a message password updated successfully.
Use the following command to logout from the root –
How to disable the root User Account?
Now if you want to disable the root account login, then execute the following command in your terminal.
sudo passwd -dl root
--delete – The option will delete the password of a user and make a named account passwordless
--lock – This option will disable the password of an account by changing it to a value which matches no possible encrypted value. It adds
! at the beginning of the password.
Now you can verify it by executing the following command-
When you enter your root password it will display a message saying authentication failure. It means the root account login has been disabled.
To know more about
passwd command see its manual page by using-
You might also like
Gparted (also known as GNOME partition editor) is a free partitioning tool. This is a GUI application that uses GNU parted in the backend. Gparted is used to create, delete,
This post was last updated on August 1st, 2020 at 09:43 pmNginx, which is pronounced as ‘engine x’ is a free, opensource and high-performance HTTP server. It is among the
This post was last updated on August 1st, 2020 at 10:33 amIn Unix-like operating systems such as Linux, a shell is a program that interprets the command, executes, takes input(s),