How to Change Root Password in Ubuntu 24.04

In Linux, a root password protects your system as it can give you full access to the root privileges. If you share your root password with anyone, your system can be at risk. That’s why you must carefully create and handle a strong root password. However, administrators sometimes share their passwords with other users, which can compromise the system’s privacy.

In that case, you can change the root password in Linux. So, let’s check these methods to change the root password in Ubuntu 24.04 without making the system vulnerable to security threats.

Changing the root Ubuntu password is simple; you can easily do this with some command-line methods.

Change the Ubuntu 24.04 password using the command line

The passwd Command

Through the passwd command, changing the root password is quite simple, and you can easily do this by running the below command in the terminal:

sudo passwd root
sudo password root

Now, type the new password and confirm it. The output may show that the root password has changed.

Root users have the privilege of changing their password. To do the same, log in as the root user through this command:

sudo -i

Next, open the configuration file using the ‘passwd’ command. Afterwards, enter the new password and retype it again for confirmation.

change user password

Finally, the terminal will confirm that your password has been changed successfully. For verification, you may again login as a root user by this command:

su -
login as root user

Now, enter the updated password, and you will be logged in as a root user, which verifies that the root password has been changed. Once done, log out of the root user access by typing ‘exit.’

Change Ubuntu password using GUI System Settings

This approach is suitable for new Linux users. First, navigate to ‘settings‘ from the Application Menu.

Open Ubuntu Settings

 Next, open the ‘users‘ option in the system menu:

Users Option in Ubuntu System Settings

Some settings are locked, so click on the unlock button.

Unlock Ubuntu system settings

You must enter your user password to make changes to unlock the settings.

Enter the user password

Now, click on the Password open to launch a new pop-up.

Launch Password changer

Here, type the current password and enter a new one. To apply the changes, click on the change icon.

graphical user interface to change ubuntu user password

Finally, you can log out of the root account and try to log in with the new password to verify that it has been successfully changed.

Wrapping Up

Changing the root password increases security, making it difficult to breach an account. You can change your root password through the terminal or system settings (GUI method). If we are talking about the command line, you can change the root password by logging in as a root user or regular user. Here, we include both of these methods; you can use any one of them. Meanwhile, those uncomfortable with the terminal method can approach the graphical method.

Other Articles:





Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.