The two ways to change your Kali username

You can change your Kali username in two ways: rename your user account while keeping the home directory name the same, or rename both the account and the directory together. The first method is faster and safer for most people. The second is cleaner if you are setting up a fresh system or do not mind the extra steps.

Both methods require you to be logged in as root or to have sudo access. If you cannot run sudo commands without a password prompt, you will need the root password instead. Either way, you cannot rename the account you are currently logged into — you must switch to a different user first, or use a live boot environment.

The commands themselves are straightforward, but the order matters. Doing them out of sequence can lock you out of your home directory or break your ability to log in.

Key Takeaways

  • You must log out of the account you want to rename before you can change its username.
  • The usermod command changes the username; the mv command changes the home directory path if you want both to match.
  • If you change only the username and leave the home directory as is, your login will still work but the path will look mismatched.
  • After renaming, log back in with your new username to confirm the change took effect and that you can still access your files.

Renaming the account without changing the home directory

This is the faster option and the one most people should use. Log out of the account you want to rename. Open a terminal, switch to root (type su and enter the root password, or use sudo -i if you have sudo access), and run this command:

usermod -l newusername oldusername

Replace newusername with the name you want and oldusername with the current name. For example, if your current username is kali and you want to change it to analyst, the command is usermod -l analyst kali. The system will update the username when ready. Your home directory will still be at /home/kali even though your username is now analyst. This mismatch does not break anything — your login will work fine, and you will still own all your files.

Log out of the root session by typing exit, then log back in with your new username to confirm it worked.

Renaming both the username and home directory

If you want the home directory path to match your new username, you need two commands. First, rename the account with usermod as described above. Then, rename the home directory itself.

While logged in as root, run mv /home/oldusername /home/newusername. For example, mv /home/kali /home/analyst. This moves the entire directory and everything in it to the new path. After this step, your username and home directory will both be analyst, and the path will be /home/analyst.

You should also update the home directory setting in the user account to match. Run usermod -d /home/newusername newusername. This tells the system where to find the home directory when you log in. Without this step, the system might look in the old path and fail to load your desktop environment or shell configuration.

Log out and log back in with your new username to confirm everything is working.

What to do if you cannot log in after renaming

If you renamed the account or directory and now cannot log in, the most common cause is that the usermod command for the home directory path did not run, or ran with a typo. You can fix this from a live boot environment or by logging in as root.

Log in as root and run usermod -d /home/newusername newusername again, checking that the path is spelled correctly and matches the actual directory name. If the directory itself is in the wrong place, use ls /home to see what directories exist, then use mv to move it to the correct path.

If you are locked out entirely, boot from a Kali live USB, open a terminal, and mount your hard drive. You can then navigate to the home directory and check its name, or use chroot to access your system as root and run the usermod commands from there.

Changing the display name separately from the username

The username (also called the login name) is what you type at the login prompt. The display name (or full name) is what appears in the system menu and in some applications. You can change the display name without touching the username.

While logged in as root or with sudo, run usermod -c "New Display Name" username. For example, usermod -c "Security Analyst" analyst. This updates only the comment field in the user database. Your login name stays the same, and you will still log in with your original username.

This is useful if you want to keep your login name stable (so scripts and file permissions do not break) but want a different name to show up in the user interface.

Why you might want to rename your account

The default Kali username is kali, which works fine for learning and testing. You might rename it to match your real name, to match a naming convention at work, or to set up a more professional-looking system. Some people rename it to something less obvious for security through obscurity, though this is a weak security measure on its own.

Renaming does not change your permissions, your password, or your ability to use sudo. It is purely cosmetic from the system's point of view, though it does affect file paths and how the system refers to you in logs and configuration files.

Frequently Asked Questions

Can I rename my account while I am logged in?

No. You must log out first or switch to a different user account. The system does not allow you to rename an account that is currently in use. If you are the only user, log out completely, then log in as root to run the usermod command.

Will renaming my account break my sudo access?

No. Sudo permissions are tied to the username in the sudoers file, and usermod updates that reference automatically. After you rename your account and log back in, sudo will work with your new username.

What if I forget my new username after renaming?

Log in as root and run id or whoami to see the current username. You can also run cat /etc/passwd to see all user accounts and their names. If you need to change it again, follow the same steps with your new choice.

Does renaming affect my installed programs or files?

No. Programs are installed system-wide and do not depend on your username. Your personal files stay in your home directory regardless of what the directory is named. Permissions might look different in listings (the username will show as your new name), but you will still own and be able to access everything.

Can I rename my account back to the original name?

Yes. Use the same usermod command with the old name as the new name. For example, if you changed from kali to analyst and want to go back, run usermod -l kali analyst. If you also renamed the home directory, use mv to rename it back, and update the home directory path with usermod again.