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:

whoami

The output of the above-given command:

root

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:

Conclusion

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

Recommended Linux Ubuntu Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *