How to Reset Root User Password on Ubuntu 22.04

If you have forgotten the password of the root user or want to reset it for some reason, type the command sudo -i to become the root user and type the passwd command to reset the password at the command line or terminal on ubuntu 22.04 or 20.04.

Ubuntu 22.04 Reset Root User Password Command Line

Here are steps to reset root user password on ubuntu 22.04:

Step 1: Open a Terminal Window

To begin, open a Terminal window or command line. You can do this by pressing Ctrl + Alt + T simultaneously or by searching for “Terminal” in the application launcher.

Step 2: Switch to the Root User

To reset the root password, you need to have superuser (root) privileges. You can do this by using the sudo -i command:

sudo -i

This will prompt you to enter your user password. After entering the password, you will be granted a root shell, and the command prompt will change to something like:

root@yourhostname:~#

Step 3: Reset Root User Password Ubuntu

Now that you are logged in as the root user, you can change the root password using the passwd command:

passwd

Running this command will prompt you to enter a new password for the root user. You will be asked to enter the new password twice for confirmation. Please ensure that your password is strong and not easily guessable.

Step 4: Exit Root Shell

After you have successfully changed the root password, you should exit the root shell to return to your regular user privileges:

exit

Step 5: Test the New Password

To ensure that the root password has been changed successfully, you can open a new Terminal window and try logging in as the root user using the new password:

su -

You’ll be prompted to enter the root password.

Here is the video guide on how to reset root user password on ubuntu command line:

Conclusion

  • resting the root password via the command line involves using the passwd command under root privileges.
  • Always prioritize security and create strong, unique passwords.
  • Limit the usage of the root account and prefer sudo for administrative tasks to reduce security risks.
  • For any issues, consult official documentation or seek assistance from the Ubuntu community.

Recommended 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 *