How to Change the Root Password on Ubuntu 22.04


To change the root user password on Ubuntu, you need to open the terminal and use the sudo -i command to switch to the root user, after that, type the sudo passwd root command and press Enter, this will open a prompt to change the password.


How to Change the Root Password on Ubuntu 22.04

Here are some steps to change root user password on Linux Ubuntu 22.04 or 20.04 using command line:

Step 1 – Open Terminal

First of all, open the terminal using the keyboard shortcut CTRL+ALT+T.

Step 2 – Switch to the Root User

Now you have to switch from normal user to root user on ubuntu, for this, you have to type the command sudo -i on your terminal or command line and hit enter:


sudo -i

Run the whoami command to verify that the user is changed:


The output of the above-given command:



Step 3 – Change the Root Password on Ubuntu 22.04

Now on your ubuntu terminal window, you have to type sudo passwd root, and this command will help to set or change the password of root user.

sudo passwd root

When you type sudo passwd root, after that the prompt for enter password and re-enter password will open, here you enter your new password for the root user and change it.


That’s it! The root password has been changed.

Step 4 – Verify Root User New Password

This is an option step, if you want to verify the password of your root user that you have changed by using above the steps, you have to use the command:

su -

Here is the video guide on how to change or reset the root user password on ubuntu:


Through this tutorial, we have learned how to change root user password in linux ubuntu using command line.


Recommended Linux Ubuntu Tutorials



Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.


Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00