Every Kali Linux system comes with a superuser account that has access to the other user accounts. Thanks to that, even if you forget the credentials of any normal user account, you can simply change it using your root password and superuser credentials. Easy, short, and efficient, right? But what if you, under an administrator account, forget the root password itself? Although it would be a terrible situation, Kali Linux comes with a built-in solution. In this article, we will show you some easy steps to restore the Kali Linux root password. Let’s dive in.
Instructions to Restore Root Password on Kali Linux
Here’s what you need to do to restore the Kali Linux root password:
- Get into the Kali Linux GRUB menu. The GRUB menu should usually appear when you boot your Kali Linux device. If the GRUB menu isn’t showing up for some reason, reboot your computer and keep pressing the “Shift (for some computer manufacturers, it’s the Esc key)” key until it appears.
- Once the GRUB menu shows up, you need to use the “Arrow” keys to select “Advanced options for Kali GNU/Linux.” Remember, you need to select this option fast. Otherwise, the GRUB bootloader will time out in a few seconds.
- In the next menu, if you have multiple options to select from, choose the “Recovery mode” one to continue.
- Next, press the “E” key to enable the “Edit Mode” in the “GRUB Configuration” file.
- Now, find the line that starts with “linux” and look for the “ro” characters in the line. After that, use the “Arrow” keys to navigate to “ro” and change it to “rw” characters. With this, you’re changing the “read-only” mode to the “read-write” mode.
- Next, type “init=/bin/bash” at the end of the “linux” line. With this, you’re commanding the “GRUB bootloader” to start the “bash” shell after mounting the root partition with “read-write” permission.
- Once you’re done making the edits mentioned above, you need to boot your device by pressing either “F10” or “CTRL + X” keys depending on your computer manufacturer’s configuration. Kali Linux will boot directly into the shell with the “[email protected](none) :/#” prompt.
- Now, type “passwd” in the prompt to initiate the process of changing the root password. After that, you need to type your new root password in the “New password:” and “Retype new password:” lines. Once set a new one, the “passwd” prompt will appear again and inform you about the successful password change.
- Since you have successfully changed your root password, you merely need to restart your device once again. To do it, type “reboot” in the shell, and the computer will go through a reboot.
Congratulations. Now, you can use your new root password on your Kali Linux device. Also, there is no need to revert the GRUB bootloader to its previous configurations. The modifications you made in the steps above are temporary. To clarify, the GRUB bootloader will automatically reconfigure itself to its previous state after you reboot your computer.