Change your Kali username and password from the terminal
Kali Linux stores your username and password in system files that you can modify directly through the terminal. The fastest way is to use two commands: usermod to change your username, and passwd to change your password. Both work whether you are logged in as the user you want to change or as root, though the steps differ slightly depending on which account you are using.
If you are logged in as the user whose name you want to change, you cannot rename yourself while you are still logged in — the system will not let you. You have two options: log in as root first, or use a live USB to boot Kali without logging in as anyone. If you are already root or logged in as a different user, you can change any username directly.
Key Takeaways
- Use the usermod -l newname oldname command to change a username, and passwd username to change a password.
- You cannot rename the account you are currently logged in as — you must switch to root or log in as a different user first.
- Changing a username does not automatically rename your home folder, so you may need to move it separately with the mv command.
- If you forget your root password, you can reset it by booting into single-user mode or using a live USB.
Change your password while logged in as your own user
The passwd command is the simplest way to change your own password. Open a terminal and type passwd with no username after it. The system will ask you to enter your current password first, then prompt you twice for the new password.
Kali will not show the characters you type for security reasons — the cursor will not move or show dots. Type carefully, because if the two new passwords do not match exactly, the change will fail and you will have to start over. Once both match, the system confirms the change when ready.
Change another user's password as root
If you are logged in as root, you can change any user's password without knowing their current one. Type passwd username, replacing "username" with the actual account name. Root does not have to enter the old password — you only enter the new password twice.
This is useful if you have forgotten a password or need to reset an account. The user can then log in with the new password and change it again to something only they know.
Change your username as root
To change a username, you need root access. If you are not already logged in as root, type sudo su and enter your password to switch to the root account. Then type usermod -l newusername oldusername, replacing both names with the actual ones.
The system makes the change silently — if you see no error message, the username has been updated. You can verify it by typing id username and checking that the name now matches what you entered.
One important detail: changing the username does not automatically rename your home folder. Your home folder will still be named after the old username. If you want the folder name to match, you need to move it separately. Type mv /home/oldusername /home/newusername to rename the folder as well.
Change your own username by logging in as root first
If you want to rename the account you are currently using, log out first. At the login screen, log in as root instead (or as a different user if one exists). Once you are logged in as root, open a terminal and use the usermod command to rename your original account.
After the rename is complete, log out and log back in with your new username. If you renamed your home folder as well, everything will be in the right place. If you did not rename the folder, your files will still be there, but the path will not match your username anymore.
Reset your password if you forgot it
If you have forgotten your password and cannot log in, you can reset it using a live USB. read a Kali Linux ISO file, write it to a USB drive using a tool like Balena Etcher or Rufus, and boot your computer from that USB. Once Kali is running from the USB, open a terminal and mount your hard drive, then use chroot to access your system files as if you were logged in normally.
From there, you can use the passwd command to reset your password. The exact steps depend on how your drive is partitioned, so you may need to check which partition holds your home folder first. Once you have reset the password, reboot normally and log in with your new password.
Frequently Asked Questions
What happens to my files if I change my username?
Your files stay in their original location. If you do not rename your home folder to match your new username, the folder path will still show the old name, but you can still access everything. It is cleaner to rename the folder at the same time using the mv command.
Can I change the root password the same way?
Yes. If you are logged in as root, type passwd with no username to change the root password. If you are a regular user with sudo access, type sudo passwd root to change the root password without switching accounts.
Do I need to restart Kali after changing my username?
No restart is required. The change takes effect when ready. You can log out and log back in with your new username right away, or continue working if you changed someone else's account.
What if the usermod command says the user is currently logged in?
You cannot rename an account while that user is logged in. Log out completely, then log in as root or a different user before running the usermod command again.