This guide will show you how to quickly reset a lost password for root in Kali Linux 2021 or other previous releases. This happened to me recently as I took some time off from using Kali Linux to find out I can’t remember the complex root password I set for it initially. I guess I’m getting old.
Resetting a lost password for root in Kali Linux 2021 is quite a simple, straightforward process, requires rebooting your system, and can be done in less than a minute.
It requires editing the Kali Linux GRUB loader in Advanced options, changing the ro [read-only] mode to rw [read-write], and adding init=/bin/bash to instruct the Linux kernel to boot into the shell. Once there, execute the passwd command, change and confirm the new password for root, and reboot the system.
Let’s take all the above instructions one by one and see how exactly a root password reset works in Kali Linux – and any other Linux distributions for that matter.
NOTE: if you are using Kali Linux VMware image and you want to change the default root password toor to something else, follow this guide instead.
Without further ado, let’s get your Kali root account back to life.
Reset Lost Password For root In Kali Linux
Step 1: Boot Kali Linux
Boot the system and be ready to implement the following step [Step 2] at the Kali Linux GRUB Welcome screen.
Step 2: Select Advanced options for Kali GNU/Linux
On the Kali Linux GRUB menu, use your keyboard arrows to navigate and select the Advanced options. You’ll need to be fast as the boot loader has a timeout of a few seconds set by default.
NOTE: If for whatever reason you can’t see the Kali Linux GRUB Welcome screen when booting, reboot the system and hold the Shift [in some cases ESC] key.
Step 3: Press the e key to enter the GRUB edit mode
If you have multiple entries in the Kali Linux Advanced GNU GRUB menu, navigate and select the recovery mode entry, then press the e key on your keyboard to enable the edit mode.
Step 4: Change the boot mode to read-write
Look for the line starting with linux, locate the ro [read-only] mode and change it to rw [read-write] mode.
NOTE: use the arrow keys on your keyboard to navigate through the GRUB file.
Step 5: Inform the kernel to boot into shell mode
On the same line starting with linux, type at the end of the line init=/bin/bash to inform the kernel to boot into the shell mode. At this point, your boot loader should include the changes highlighted below:
Step 6: Boot Kali Linux
Once done, press F10 or CTRL+X to boot. Kali Linux will boot into the shell now, and you will be welcomed with a shell prompt like this:
Step 7: Reset the root password
Use the passwd command to reset the root user in Kali Linux. Type the new password and confirm it when prompted.
passwd
Step 8: Reboot Kali Linux
Once the root password is updated successfully, reboot the system by executing the following command in the shell:
reboot
Alternatively, you can reset, power off/on your computer, and proceed to boot Kali Linux as you would typically do.
NOTE: You don’t need to edit your GRUB loader again to revert it to the initial state. The changes performed earlier are pertinent for the first boot only and will be lost consequently.
Wrapping Up
As you can see, resetting your lost password for root in Kali Linux is not a difficult task at all, and you don’t have to proceed with something drastic like reinstalling your system.
Though I doubt you will need to reset your root account often, I advise you to bookmark this guide just in case you will run into this problem again in the future. If you are looking for more useful guides like this, check the Linux section of this website.
I hope you found this quick guide for Kali Linux useful See you next time.
