Boot into single-user mode to reset your username
If you've forgotten your Kali Linux username, the fastest way back in is to restart your machine and interrupt the boot process. When you see the GRUB menu (the black screen with boot options), press e to edit the default entry. Find the line that starts with linux and go to the end of it. Add the text init=/bin/bash, then press Ctrl+X to boot.
You'll land at a root bash prompt without needing any password. From here, you can read the files that store your username information. This works because you're booting directly into a shell instead of the normal login sequence.
Key Takeaways
- Single-user mode (accessed by editing the GRUB boot entry) gives you root access without a password, letting you view or change username information.
- The file /etc/passwd contains all usernames on your system; each line starts with a username followed by a colon.
- If you need to create a new user account because you cannot remember the old one, use useradd -m -s /bin/bash newusername while in single-user mode.
- After making changes, type exit or press Ctrl+D to continue the normal boot process and log in with your recovered or new username.
Read /etc/passwd to find all usernames on your machine
Once you're at the root bash prompt in single-user mode, type cat /etc/passwd and press Enter. This file lists every user account on your system. Each line represents one user, and the username is always the first part before the colon.
For example, a line might look like alice:x:1000:1000:Alice Smith:/home/alice:/bin/bash. The username here is alice. Scroll through the output and look for usernames that are not system accounts — system accounts usually have names like root, daemon, bin, or nobody, and they typically have user IDs (the number after the second colon) below 1000. Your personal account will usually have an ID of 1000 or higher.
Create a new user account if you cannot identify the old one
If you see multiple user accounts in /etc/passwd and cannot remember which one is yours, or if the account you think is yours no longer works, you can create a new user account while in single-user mode. Type useradd -m -s /bin/bash newusername, replacing newusername with whatever you want to call yourself.
The -m flag creates a home directory for the new user, and -s /bin/bash sets bash as the default shell. After creating the account, set a password by typing passwd newusername and entering a password twice. You can then exit single-user mode and log in with this new account.
Reset the password for an existing username you remember
If you know your username but forgot the password, single-user mode lets you change it. At the root bash prompt, type passwd username (using your actual username). You will be prompted to enter a new password twice. You do not need to know the old password — root access bypasses that requirement.
After setting the new password, type exit or press Ctrl+D to continue booting normally. When you reach the login screen, enter your username and the new password you just set.
Exit single-user mode and boot normally
Once you have found your username, created a new account, or reset a password, type exit at the bash prompt. The system will continue the normal boot sequence and eventually show you the login screen. Log in with the username and password you now have access to.
If the system asks for a root password during boot, you can usually press Enter to skip it, or use the username and password you just set. If you encounter a different login screen than expected, you may be using a display manager like LightDM or SDDM — just enter your username and password as normal.
find your system after regaining access
Once you are logged in, consider why you forgot your username in the first place. If you use your machine regularly, write your username down in a find location — a password manager, a physical notebook kept somewhere safe, or a document encrypted with a tool like gpg. This prevents the same situation later.
You should also check whether anyone else has accessed your machine while you were locked out. Look at the login history by typing last at a terminal to see recent logins. If you see activity you do not recognize, change your password again and consider whether your system security needs attention.
Frequently Asked Questions
What if my GRUB menu does not appear when I boot?
Hold down the Shift key as soon as your machine starts, before the Kali logo appears. This forces GRUB to display. If that does not work, try holding Esc instead. Some systems require you to press a specific key like F2 or Del — check your motherboard manual or the boot screen for hints.
Can I do this if my disk is encrypted?
No. If your Kali installation uses full-disk encryption (LUKS), single-user mode will not help because you cannot read the encrypted disk without the encryption password. You would need to know the encryption password or reinstall Kali. This is why encryption protects against this type of recovery.
Will this work if I am using a virtual machine?
Yes. The same process works in VirtualBox, VMware, or any other hypervisor. When you see the GRUB menu, press e just as you would on a physical machine. The virtual machine's keyboard input works the same way.
What if I see "Permission denied" when trying to edit GRUB?
You should not see this error in single-user mode — you are already root. If you do, you may not have actually entered single-user mode. Restart and make sure you pressed e at the GRUB menu, found the linux line, and added init=/bin/bash at the end before pressing Ctrl+X.
Do I need to reinstall Kali if I cannot remember my username?
No. Single-user mode recovery works in almost all cases unless your disk is encrypted. Reinstalling should be your last option, and only if you cannot boot into single-user mode or if you have encrypted your disk and do not know the encryption password.