Ubuntu is a Debian-based Linux operating system that comes with many attractive features and one of them is the terminal through which you can manage all the operations of Ubuntu. To manage the administration operations you have to be a root user or should know the root password, as the security of Ubuntu is strong enough that unauthorized users cannot access it. But as we are human beings, sometimes we forget many things, likewise if we forgot the root password of Ubuntu, then what will happen? We have to reinstall the operating system but doing so can delete all the important data which is stored on Ubuntu so this method is not practical.
In this guide, we will find out some convenient methods by which we can recover the root password of Ubuntu if forgotten without reinstalling it.
How to reset the root password on Ubuntu if forgotten
If we have forgotten the password, then the issue will occur at the login step that we cannot log in without providing the set password:
So now we will open the GRUB (GRand Unified Boot Loader) menu by restarting the Ubuntu and pressing the ESC/SHIFT key from the keyboard:
When this type of screen is displayed successfully, then press the “e” key from the keyboard to edit the commands before booting the operating system:
Now scroll down the bar until you find a line “ro quiet splash $vt_handoff”:
Now replace this line with the mentioned-below line:
Now boot the operating system by pressing either CTRL+X or F10 key from the keyboard:
The root terminal will be open, now here we will set the new password by using the command:
After setting the new password, restart Ubuntu operating system with the command:
Enter the new set password in the log in screen:
And here you are back to the home screen of Ubuntu:
Sometimes we might forget the root password of Ubuntu so we cannot access the Ubuntu operating system and we are upset that we have to reset the password by resetting the operating system which may lose the important data stored on Ubuntu. But in this guide, a method has been given by which we can reset the root password on Ubuntu 22.04 if forgotten.