Javatpoint Logo
Javatpoint Logo

How to Change root user password ubuntu

Suppose you have just started using Ubuntu or switched to Ubuntu from another operating system and want to change the default root password but do not have enough knowledge about it. So this tutorial will help you know how to update your ubuntu operating system's current (or default) password. You can also adopt given methods to change the root password in many other Linux-based operating systems such as Kali Linux, Parrot, Debian, Fedora, etc.

Like several other Linux based operating systems Ubuntu also allows multiple user accounts, each having its password. In Ubuntu, every user only allowed to change or update the password of their own account.

How to Change root user password ubuntu

Prerequisites

  • Ubuntu installed and running
  • A user with sudo privileges
  • Access to a terminal/command line
  • The apt-get tool, pre-loaded in Ubuntu and other Debian-based distros

How to change the root password in Ubuntu?

Here we will discuss all three methods. You can use any of these methods to update the Ubuntu operating system's root password, which you find easy or comfortable.

The Ubuntu terminal is used in the first two methods, but don't worry, it is not that difficult. We will explain these methods in details as well as with the practical. Still, if you don't feel comfortable with the first two methods, you can use the easiest third method as it uses Linux's graphical interface or GUI.

Method 1- Changing the root password using the terminal

To change the root password using the terminal, consider the following given steps:

1. First of all, open the terminal by pressing the key "Ctrl + Alt + T" on the keyboard, as shown below:

How to Change root user password ubuntu

2. Once the terminal gets open, type the following given command and hit enter:

Command:

Once you hit enter after typing the command above, you will be prompted to enter and to verify the new passwords as shown in the given image:

How to Change root user password ubuntu

3. Now close the terminal using the following command:

Command:


How to Change root user password ubuntu

In some rear cases, to reflect or apply the changes, it may be quite possible that your operating system asks you to restart your system. If it happens, restart your system, and once you restarted your system, you are all set. Your root password is now changed or updated.

Method 2- Change sudo Password with the passwd Command

This method can be considered an alternate of the first method because, in this method, the user first switches to the root user(or superuser) and then runs the "passwd" command to change the root password. Consider the following instructions to change the password in Ubuntu:

1. First, open the terminal (CTRL+ALT+T).

2. Now, switch to the root user by the following command:

Once you execute the above command, you have to Enter/Type your current password and hit the Enter button. In the obtained output, you should notice that now you can run all the commands as the root user (or Super User).

How to Change root user password ubuntu

3. Next, to change the current password, use the following command:

Now, type the new password and press enter button. It will also ask you to re-enter your new password to ensure that both time you entered the same password. So type your new password one more time. If both passwords are identical, you can go to the next step. In the case where your password gets mismatched, you can re-write the "passwd" command and try again.

How to Change root user password ubuntu

4. After updating the previous password with new a password, you can log out of the root user by using the following command :

Output

How to Change root user password ubuntu

5. Now, you can Exit out of the terminal with the same command:

Option 3: Changing Ubuntu Password Using GUI

In order to change the default password of an individual account in Ubuntu, one can also do so using only the Graphic User Interface instead of using the terminal. To change the default root password in Ubuntu without using the terminal or any commands, consider the following the given steps:

1. First of all, open the Activities overview by pressing the Windows or by clicking on it shown below:

How to Change root user password ubuntu

2. Type the "Settings" in the search bar and click on the Settings icon. Once the setting icon appears, click on it to open, as shown below:

How to Change root user password ubuntu

3. In Settings, search for the "Details or Users". In our case, the desired settings are available under the "Users", as shown in the given image:

How to Change root user password ubuntu

4. Now click on the "Password" in order to change or update the current password as shown below:

How to Change root user password ubuntu

5. Once you click on the "Password", a prompt will open in which you will be asked to enter the current password, to enter the new password and then re-enter the new password. In most case, the obtained prompt looks like as given below:

How to Change root user password ubuntu

After filling up all required fields, all you have to do, click on the "Change" button as shown in the given image:

How to Change root user password ubuntu

6. Now, your password is updated. You can exit out form "Settings" by closing the current window, as shown below:

How to Change root user password ubuntu

Conclusion

In the above, we have discussed three methods to change the password for the root user in Ubuntu operating system. Each of all provided methods includes the simplest steps that anyone can follow and complete.

Note: A user should always ensure that his password includes both lower and upper letters, numbers, and special characters and should change or updated from time to time. It is essential that all users must use a strong password in order to avoid brute force attacks because a simple password can be cracked very easily and requires very little time to crack.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA