How to change your username and password in Kali Linux VirtualBox
You can change your username and password in Kali Linux running on VirtualBox through the terminal or the graphical settings menu. The terminal method is faster and works reliably; the graphical method is more visual if you prefer clicking through menus. Both require you to be logged in as the user whose password you want to change, or to have root access.
The default Kali Linux user is kali with password kali. If you are running a fresh installation, you will start with these credentials. Changing them when ready is a good practice, especially if your virtual machine is on a shared network or if you plan to use it for sensitive work.
Key Takeaways
- Change your password in the terminal by typing passwd and entering your current password, then your new password twice.
- Change your username by opening a root terminal and using the usermod -l newname oldname command, then renaming your home directory.
- The graphical method works through Settings > Users & Groups, but requires you to unlock the panel with your current password first.
- After changing your username, you must also rename your home directory from /home/oldname to /home/newname, or your system may not find your files.
- Test your new credentials by logging out completely and logging back in before closing VirtualBox.
Changing your password from the terminal
Open a terminal in Kali Linux and type passwd, then press Enter. The system will ask you to enter your current password. Type it and press Enter — the text will not appear on screen, which is normal. Then type your new password and press Enter. Type the new password again to confirm it. If both entries match, the system will confirm the change with a message like "passwd: password updated successfully".
Your new password takes effect when ready. You do not need to restart or log out. If you make a mistake and the passwords do not match, the system will tell you and ask you to try again. Choose a password that is at least 12 characters long and includes uppercase letters, numbers, and symbols if possible — this makes your virtual machine harder to break into if someone gains network access to it.
Changing your username from the terminal
Changing your username is more involved because it affects file ownership and your home directory path. Open a terminal and type sudo su to become the root user, then enter your current password. You are now running as root, which you need to rename an active user account.
Type usermod -l newusername oldusername, replacing newusername and oldusername with your actual names. For example, if you want to change from kali to analyst, type usermod -l analyst kali. Press Enter. The system will not print a confirmation message — silence means success.
Next, you must rename your home directory to match. Type mv /home/oldusername /home/newusername. For the example above, that would be mv /home/kali /home/analyst. Press Enter. Now type exit to leave the root shell and return to your normal user prompt.
Log out completely by clicking the power icon in the top right corner and selecting Log Out, or by typing logout in the terminal. When the login screen appears, your new username should be available. Click it, enter your password, and press Enter. If you see your desktop and your files are present, the change worked correctly.
Changing your password through the graphical settings menu
Click the power icon in the top right corner of the screen and select Settings. In the Settings window, look for Users & Groups or Accounts — the exact name depends on your Kali version. Click it. You will see a lock icon next to your username; click the lock to unlock the panel. Enter your current password and click Authenticate.
Once unlocked, click your username in the list. A Password field will appear. Click the field and type your new password, then click outside the field or press Tab to confirm. Some versions require you to click a Change button. Close the Settings window. Your new password is now active.
Changing your username through the graphical settings menu
The graphical method for changing your username is less reliable than the terminal method because it does not always rename your home directory correctly. If you must use the graphical interface, open Settings and find Users & Groups. Click the lock icon and authenticate with your current password. Click your username in the list and look for a Full Name or Account Name field.
Some versions of Kali allow you to edit the username directly; others do not. If you can edit it, change the name and close Settings, then open a terminal and manually rename your home directory using sudo mv /home/oldname /home/newname. If the field is locked, use the terminal method instead — it is faster and less error-prone.
What to do if you forget your new password
If you change your password and then forget it, you can reset it by booting into single-user mode or recovery mode. Restart your VirtualBox virtual machine. As soon as you see the Kali boot menu, press Escape or the spacebar to interrupt the boot. Look for an option that says "Advanced options for Kali GNU/Linux" or similar, and select it. Then select a recovery or single-user mode option.
The system will boot to a root prompt without asking for a password. Type passwd username, replacing username with your actual username. Enter a new password twice. Type exit to continue booting normally. You can now log in with your new password. This process varies slightly between Kali versions, so if the boot menu looks different, look for any option mentioning "recovery" or "single user".
Testing your changes before you finish
After changing your username or password, do not close VirtualBox when ready. Instead, log out by clicking the power icon and selecting Log Out. Wait for the login screen to appear. Click your username (or type it if it does not appear as a button), enter your new password, and press Enter. If you see your desktop and your files are there, the change worked.
If the login fails, you are still logged in to your previous session. Go back and check your work: make sure you typed the password correctly both times, and make sure you renamed your home directory if you changed your username. If you changed your username and your files are missing, the home directory rename did not complete — use the recovery mode method above to log in as root and check that /home/newname exists and contains your files.
Frequently Asked Questions
Can I change my username without changing my password?
Yes. Follow the terminal method for changing your username only, and skip the password steps. Your password stays the same, but you will log in with your new username and the same password you used before.
What if I change my username and my files disappear?
Your files are still there — they are just in the old home directory. Open a terminal and type ls /home to see all home directories. If you see both /home/oldname and /home/newname, your files are in /home/oldname. Type sudo mv /home/oldname/* /home/newname to move them. If /home/oldname is the only one there, you forgot to rename it — use sudo mv /home/oldname /home/newname first.
Do I need to restart VirtualBox after changing my password?
No. Password changes take effect when ready. You can keep working without restarting. However, you should log out and log back in to make sure your new password works before you close VirtualBox.
Can I change the password for the root user?
Yes. Type sudo passwd root in a terminal, enter your current password, then enter a new root password twice. You can then log in as root using that password, though Kali does not normally allow direct root login at the graphical login screen — you would need to use sudo su in a terminal instead.
What if the passwd command says "permission denied"?
This usually means you are trying to change another user's password without root access. If you want to change your own password, type passwd with no username after it. If you want to change another user's password, type sudo passwd username instead.