Recover your forgotten root password for Ubuntu 22.04 Jammy Jellyfish server or desktop by resetting it. Here are the commands to follow for that.
Forgotten passwords are always annoying – especially when it comes to your computer password. So you can no longer access your important data.
Among the numerous tasks that we have to carry out every day when managing Linux operating systems is resetting the password of the users, whether they are logged in or not, to regain access to the system and make it work properly. However, being an administrator you need root user access for that. But what happens if you forget the root password. In such conditions, you won’t be able to perform the core tasks of your computer. This problem often occurs because users use multiple passwords on multiple platforms. So, here is the solution for that.
Steps to reset forgotten root password on Ubuntu 22.04
To reset the password, first, we have to access the Grub menu of our Ubuntu 22.04. Restart your system and while doing that press and hold the Shift key on your Keyboard. This will drop you into the Grub menu of Ubuntu.
2. Edit Gurb Menu to Reset root password
The next step is to edit the default boot entry of your Ubuntu 22.04. For that press the ‘e’ key on your keyboard. This will let you edit the Grub’s boot prompt. Don’t touch or delete anything here. Once you have the editor move to the next step.
3. Add rw init=/bin/bash
On the Grub editing screen, use your arrow key and move to the end of the line starting with “Linux“. There at end of this line type –
rw init=/bin/bash, as shown in the given screenshot.
After adding the given syntax, next, boot your system with this configuration. For that either use Ctrl+X or F10.
4. Ubuntu 22.04 Root shell Access
Now, without providing any password you will have Ubuntu’s shell with root access. Here, first, let’s check whether our user has read and write access to the file system where the OS has been installed.
For that use a command:
mount | grep -w /
If the output is:
rw,realtime) then it means you have real-time- read and write access to the file system.
5. Reset root user password
Now, let’s change the password as we do normally on a Linux system using the command terminal.
The system will prompt to add a new password two times:
To change the password of some other user than root, we have to mention the username of the same. For example, if our system user name is h2s and we want to change the password of that then the command will be:
6. Reboot your system
Once you are done resetting your Linux password then restart your system to log in with the changed password. For rebooting, type:
And that hit the Enter key.
From here onwards, you can log in and access your system with the newly set root password. This guide would be useful for those who somehow lose or forgot the root password and now want to change the same. The steps given in this article will also work for other Ubuntu versions as well.
• Centos 7 Linux Forgot Password Solution- How to Change it
• Reset CentOS 8/RHEL 8 forgot root password
• Forgot Your Linux Mint password- Here is a way to recover it.
• How to reset AlmaLinux / Rocky Linux 8 root password