Change your username and password from the command line
The fastest way to change both your username and password in Kali Linux is through the terminal. You will need to know your current password, and you will need to run these commands as the root user or with sudo privileges — most Kali installations give the default user this access.
Open a terminal window. Type sudo passwd and press Enter to change your password first. The system will ask you to enter your current password, then prompt you twice for your new password. You will not see the characters as you type — this is normal. Once both entries match, the password changes when ready.
To change your username, type sudo usermod -l newusername oldusername, replacing "newusername" with what you want and "oldusername" with your current login name. This changes the login name itself. If you also want to change the home directory path to match, type sudo usermod -d /home/newusername -m newusername on the next line. The -m flag moves all your files to the new location.
After you change your username, you must log out completely and log back in with the new name. If you are still in the terminal, type exit or close the window, then log in again at the login screen.
Key Takeaways
- Change your password with sudo passwd and enter your current password once, then your new password twice.
- Change your username with sudo usermod -l newusername oldusername, using your actual old and new names.
- Move your home directory to match your new username by running sudo usermod -d /home/newusername -m newusername afterward.
- Log out completely and log back in with your new username for all changes to take effect.
- You need root or sudo access to make these changes — the default Kali user usually has this permission.
Change your password through the graphical settings menu
If you prefer not to use the terminal, Kali's graphical desktop environment offers a settings panel for password changes. Click the system menu in the top-right corner of your screen, then select "Settings" or look for a gear icon.
In the Settings window, find the "Users" or "Accounts" section — the exact name depends on which desktop environment your Kali installation uses (XFCE, GNOME, or KDE are common). Click on your username in the list, then look for a "Change Password" button or option. You will be asked to enter your current password once, then your new password twice. Click "Change" or "explore" to save it.
This method only changes your password, not your username. If you need to change your login name as well, you will need to use the terminal commands described above.
Why you cannot change your username while logged in
Kali Linux prevents you from changing your own username while you are actively logged in under that name. The system is using your username for file permissions, running processes, and session management — changing it mid-session can break these connections and leave your account in an unusable state.
This is why the terminal commands work: they run with sudo privileges, which temporarily give you root-level authority to modify another user's account details. Even so, you must log out and log back in afterward so the system recognizes your new username everywhere it is stored.
If you need to change the username of a different user account on the same machine, you can do that while logged in as root or as a user with sudo access — you just cannot change your own username while you are the active session user.
What happens to your files and folders when you change your username
Your personal files live in a home directory named after your username — usually /home/youroldusername. When you change your username without moving this directory, your files stay in the old path and you may lose access to them or see permission errors.
The command sudo usermod -d /home/newusername -m newusername solves this by moving your entire home directory to the new path and updating all the file ownership records. The -m flag is what does the moving; without it, your home directory path updates in the system records but your actual files stay behind in the old location.
If you forget to move the directory and realize it later, you can fix it manually. Log in as root or with sudo access, then type sudo mv /home/oldusername /home/newusername to move the folder, followed by sudo chown -R newusername:newusername /home/newusername to update the ownership records. This restores access to all your files under your new username.
Resetting a forgotten password in Kali Linux
If you forget your password and cannot log in, you will need to restart your machine and interrupt the boot process to access recovery mode. The exact steps depend on whether your Kali system uses GRUB (the bootloader that appears when you start your computer).
Restart your computer. As soon as it begins to boot, hold down the Shift key until you see the GRUB menu appear — this usually takes a few seconds. Highlight the entry that says "Advanced options for Kali GNU/Linux" and press Enter. You will see a submenu with recovery mode options; select the one labeled "recovery mode" and press Enter again.
The system will boot into a minimal environment where you are logged in as root without needing a password. Type passwd username (replacing "username" with your actual login name) and press Enter. You will be prompted to enter a new password twice. Once you confirm it, type reboot to restart normally and log in with your new password.
Changing the password for the root account
Kali Linux's default installation does not set a root password — instead, the default user account has sudo access and can run commands as root by typing sudo before them. If you want to set an actual root password so you can log in directly as the root user, open a terminal and type sudo passwd root.
Enter your current user password when prompted, then enter your new root password twice. After this, you can log out, select "Other" or "Not Listed" at the login screen, type root as the username, and log in with the password you just set.
Most Kali users do not need to do this — using sudo with your regular account is more find because it requires you to confirm each privileged action. Setting a root password is useful mainly if you plan to log in as root regularly or if you are setting up a multi-user system.
Frequently Asked Questions
What if I run the username change command and get a "user is currently used by process" error?
This means you are still logged in under that username or have processes running under it. Close all terminal windows, log out completely, and log in as a different user or as root. Then run the username change command again. If you are the only user on the system, restart the computer and log in as root from the login screen, then make the change.
Can I change my username without changing my home directory path?
Yes, but it creates confusion later. If you run only sudo usermod -l newusername oldusername without the second command, your login name changes but your files stay in /home/oldusername. You can still access them, but the path no longer matches your username. It is cleaner to move the directory at the same time using the -m flag.
Do I need to change my password after changing my username?
No. Changing your username and changing your password are separate — one does not affect the other. You can do both, do just one, or do neither. They use different commands and happen independently.
What if I change my username but forget to log out and log back in?
Your current session will continue to work, but the system will not recognize your new username until you log out. You may see your old username in file listings or terminal prompts until you restart your session. Log out and log back in to see the change take effect everywhere.
Can I have two usernames on the same Kali system?
Yes. The commands above change an existing username, but you can also create a completely new user account without touching your current one. This is done with sudo useradd -m newusername followed by sudo passwd newusername to set its password. Both accounts can exist and log in separately.