In this guide, we intend to teach you How To Reset or Recover the Lost or Forgotten Root Password on AlmaLinux 9.
In Linux, root privileges (or root access) refer to a user account that has full access to all files, applications, and system functions.
Most basic Linux user accounts run with limited privileges. This keeps users from making mistakes or accidentally exposing the system to vulnerabilities.
To use protected operating system features, a Linux user has to temporarily elevate their privileges using a command like
sudo command tells the system to run a command as a superuser, or root user. When you run a function using
sudo, you’ll usually have to enter your password.
If you forget your root password, you can easily follow the steps below to recover it on AlmaLinux 9.
Steps To Reset Root Password on AlmaLinux 9
In this guide, we will show you to Recover Lost Root Password from the Grub Menu on AlmaLinux 9.
Follow the steps below to complete this guide.
Recover Lost Root Password from the Grub Menu
First, you need to 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 AlmaLinux 9.
Next, you need to 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.
At this point, use your arrow key and move to the end of the line starting with “Linux“. After the root ro line, type rw init=/bin/bash.
After adding the syntax, boot your system with this configuration. To do this, you can use Ctrl+X or F10.
Root Shell Access on AlmaLinux 9
At this point, without providing any password you will have an AlmaLinux 9’s shell with root access.
First, let’s check whether your user has read and write access to the file system where the OS has been installed.
To do this, run the following command:
mount | grep -w /
If you see (rw,realtime) in your output, it means you have real-time read and write access to the file system.
Change Root Password on AlmaLinux 9
Now you can simply change your root password on AlmaLinux 9 with the following command:
The system will prompt you 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. The syntax is like the following command:
When you are done resetting your Linux password, restart your system to log in with the changed password. For rebooting, run the command below:
After that, hit the Enter key.
From here, you can log in and access your system with the newly set root password.
At this point, you have learned to Reset or Recover the Lost or Forgotten Root Password on AlmaLinux 9 from the Grub Menu.
Hope you enjoy it.
You may be like these articles:
How To Disable SELinux on AlmaLinux
Disable NetworkManager on AlmaLinux 8