About 25% of people forget their computer password after 14 days of running their operating system. If you are one of those people and you forget the root password for your Ubuntu Linux VPS, don’t worry. Fortunately, there is a way to reset your root password, and it is possible to do so without knowing the password. In this article, we are going to teach you how to reset the root login password on Ubuntu 22.04.
In Ubuntu, the root password is stored in the root folder file on the Linux filesystem. This password is required to log in and you can not log in without knowing it. So first you have to somehow reset the password and add a new password.
In Ubuntu systems, the root account is the first user role and the root user is allowed to change and override the permissions of other users. The root user has the most power over the Ubuntu system and users need the root user’s permission to make changes. So, if you don’t know the system’s root password, you should disable the default root user account.
Table of Contents
How to Reset Root Login Password on Ubuntu 22.04
Step one: Open Ubuntu 22.04 Grub menu
At first, you should open Ubuntu 22.04 LTS Grub menu. To do this, restart your system and press and hold the Shift key while the splash screen appears. This will give you access to the Ubuntu Grub menu.
Step two: Edit Ubuntu 22.04 Grub menu
In this step, select the option Ubuntu and press Enter. Then you need to edit the Ubuntu Grub menu parameters. To open the editor, just press the E key on the keyboard.
In this step, you have to use the arrow key to scroll down to the end of the line that starts with Linux.
Then enter the following command at the end of the line:
rw init=/bin/bash
Then you should boot your system by using F10 or Ctrl+X to apply the changes.
Step three: Access Ubuntu 22.04 root shell
Now you can access the Ubuntu shell with root access without providing a password. Note that, before doing anything, you should check whether the user has read and write access to the file system in which the operating system is installed. To do this run the following command:
mount | grep -w /
If you receive (rw, realtime) in the output, you have real-time read and write access to the file system.
Step four: Reset the root user password
Now it’s time to change the password with the following command:
passwd
Then you will be asked to enter your new password twice.
At end you should receive “password updated successfully” message.
Note that if you want to change the password of a user other than root, you should enter the username in the command:
passwd username
Step five: Reboot the system
Finally, you need to restart your system to log in with the changed password. To do this enter the following command and hit the Enter:
exec /sbin/init
That’s it!
Conclusion
In this article, we taught you how to reset the root Login password on Ubuntu 22.04. After resetting the root login password, you can log in and access your system with your new root password. This article will be useful for those who have forgotten their password. I hope you enjoyed it.
This doesn’t work at all.
Try to do the mentioned steps correctly. You can ask if you have a problem with any of the steps.
Try to do the mentioned steps correctly. You can ask if you have a problem with any of the steps.
It worked like charm for me, many thanks
Thank you for your opinion, I am glad that it was useful for you.