Monday, May 13, 2024

How to Reset Forgotten Password on Kali Linux and VirtualBox

 


Have you ever set up the password of a personal, backup/spare, or even virtual machine and forgotten it?

Linux Kali is not the primary Operating System on my machine. I use it to perform school projects, work, and test new tools. It is on my Virtual Machine, and whenever I turn it off, I save it to continue my project on the page I stop so I don’t need to log in again. Unfortunately, this time I rebooted the system and did not remember the access password for all users, including root. So I had to take a few steps to recover my users.

Want to learn how I did it straightforwardly? So let’s go.

These steps work in any Linux Kali on the virtual machine or installed as the primary OS.

1 — The first step is to restart the system. The GRUB page will display as soon as the process finishes, as in the following image. Then quickly, we must press the “E” key to not complete the booting.


2- When we press the letter “E,” we enter the OS parameter editing page, and we must modify the code. After locating the line where it starts with the word “Linux,” at the end of that line, we need to change the permission ro (read) to rw (read and write).

3 — The next step is adding or modifying the command line. In some cases, usually when the OS is installed directly on the machine and not a virtual machine, so it is necessary to change from ro to rw and add “int=/bin/bash” at the end, but in VirtualBox, we have to insert the complement of the line. So the command should look like the following for any installation “rw initrd=/install/gtk/initrd.gz quiet init=/bin/bash”. And to save and process these changes, we will use CTRL+x or F10 to continue the boot.

4- Right after a GRUB screen appears again, we should press Enter, which will direct us to the terminal.


5- Resetting the root user password: first is confirming this in the root user, so I used the “whoami” command. Soon I used the command “passwd,” which asked me to enter the new password twice in the terminal. Then it showed a message that the password was successfully modified. Finally, insert the “reboot -f” command to restart the machine.

6- Resetting any user password: the method is the same, with the “passwd username” command and entering the new password twice, in this case, I used the username kali. And after I finished making all the changes necessary to use the command reboot -f.

Done!

No comments:

Post a Comment

TOP 20 PYTHON MODULES

 Python has a rich ecosystem of modules and libraries that extend its capabilities. Here’s a list of 20 popular Python modules along with br...