Hello.
There are basically 2 “popular” ways to try to fix the issue that you’re experiencing:
1. Use GRUB to boot into single user mode and then change your user’s account password by running this command:
passwd user
…where user
is your username. E.g. if your username is kimi625
then boot into single user mode, run passwd kimi625
and then type (and confirm) the new password. Then reboot by either running reboot
, init 6
, telinit 6
or shutdown -r now
.
2. Use your Kali Linux installation media (CD, DVD, USB flashdrive…) to boot into try-it-before-installing mode and then delete your user’s password so you can set a new one.
Once the installation media finishes booting, at the Desktop you’ll likely see the icon of your umounted Linux partition. Double-click it so it’s automatically mounted, then use the file manager to check where it’s mounted (e.g. /media/kali/kalinux/
- yup, I’m making this stuff up. I’ve never installed nor tested Kali in my life, but I’m assuming that these steps are going to work because they’re quite a “default” behavior in many Debian-based distros, and Kali is a Debian-based distro).
Now it’s time to open a shell terminal window/emulator and then become root/superuser by running this command:
sudo su
If you were unable to automount your Kali Linux partition, run the command below in order to check if the /mnt
folder exists and create it if it doesn’t:
if [ ! /mnt ] ; then mkdir /mnt ; fi
…and then mount your Kali Linux partition in /mnt
with rw
(read and write) access (I’m assuming that your Kali Linux partition is sda2
, i.e. the 2nd partition of the 1st disk. I’m also assuming that such partition is formatted as an ext4
filesystem):
mount /dev/sda2 /mnt -t ext4 -o rw
Once the partition is mounted, access its root directory. E.g.:
cd /media/kali/kalinux
or
cd /mnt
…and then run this command:
cat ./etc/passwd |more
Press the space key for pagination. The command above will output the records of all user accounts. Assuming that your username is kimi625
, you’ll end up finding a line that is going to look pretty much like this:
kimi625:x:1000:1000:Kimi,,,:/home/kimi625:/bin/bash
That x
symbolizes your encrypted password. Hence, if you delete that x
the system will let you set a new password (it won’t ask you to provide the current password, since there won’t be one). So now you have to edit the passwd
file with either a graphical text editor such as Leafpad:
leafpad ./etc/passwd
…or a console text editor such as Nano:
nano ./etc/passwd
Once you’re “inside” the passwd
file, scroll down until you reach that line of your user’s account and then delete that x
character so the line looks like this:
kimi625::1000:1000:Kimi,,,:/home/kimi625:/bin/bash
The next step is to save the passwd
file and exit the text editor, then reboot the system, remove the installation media and, after you boot normally, login by providing only your username (no password shall be asked, because you deleted it) and then open a shell terminal emulator/window again so you can run this command:
passwd
Type (and confirm) a new password for your user account, then reboot the system and check if the procedure worked, i.e. check if the login screen asks for a password and if, by typing this new password, you manage to successfully log into your account.