The fastest way to change your Kali Linux username

The quickest method is to use the usermod command, which changes your username without touching your home directory or files. Open a terminal and run this command, replacing "oldusername" with your current name and "newusername" with what you want:

sudo usermod -l newusername oldusername

This renames your account in the system files when ready. Your home folder stays at /home/oldusername, which is usually fine — Kali does not care if the folder name and username no longer match. If you want the folder name to match your new username too, add a second command: sudo usermod -d /home/newusername -m newusername. The -m flag moves your entire home directory and all its contents to the new location.

You must run these commands as root or with sudo. If you are logged in as the user you want to rename, log out first and switch to a different account or the root account, because you cannot rename an account while you are using it.

Key Takeaways

  • Use sudo usermod -l newusername oldusername to change your username without moving your home folder.
  • Add sudo usermod -d /home/newusername -m newusername afterward if you want your home directory folder name to match your new username.
  • Log out of the account you are renaming before you run the command, or switch to root or another user account.
  • Your files and permissions stay the same — only the username in the system changes.

When you need to move your home directory

If your home folder is still named after your old username and you want it renamed to match, the two-step process above handles it. The first command changes the username in /etc/passwd and related system files. The second command moves everything in /home/oldusername to /home/newusername and updates the system to point to the new location.

Run them in order without logging back in between. If you log in as your new username before moving the directory, you may end up with permission problems or a new empty home folder. The -m flag in the second command ensures all your files move with the correct ownership.

Changing the username for the root account

Renaming the root user is possible but rarely necessary and carries more risk. If you do need to change it, the process is the same: sudo usermod -l newrootname root. However, many system scripts and configuration files reference "root" by name, so changing it can break things.

A safer approach is to create a new user account with sudo privileges and use that for daily work instead. You keep root as-is, which is what most Kali systems do. If you have already changed the root username and things are broken, you can change it back the same way.

Fixing problems after a username change

If you renamed your account but did not move the home directory, and now you have permission problems, you can fix the ownership. Log in as root or another user and run sudo chown -R newusername:newusername /home/oldusername. This tells the system that the new username owns everything in that folder.

If you moved the directory but something is still looking for the old username, check any scripts or configuration files you wrote yourself. Kali's built-in tools usually do not hardcode usernames, but custom scripts might. Search for the old username in your home directory with grep -r "oldusername" ~/ to find references you need to update.

Using the GUI if you prefer not to use the terminal

Kali Linux includes a graphical user manager in some desktop environments. Open the Activities menu, search for "Users" or "Accounts", and look for a settings panel. Not all Kali installations include this tool — it depends on whether you installed the full desktop or a minimal version.

If the GUI tool is available, click your user account, unlock it with your password, and look for an option to change the username or account name. The exact steps vary by desktop environment. If you do not see a Users tool, the terminal method is the standard way and works on all Kali systems.

What happens to your files and permissions

Your files themselves do not change. The username change only updates the system's record of who owns them. If you used the usermod command without moving the directory, your files stay in /home/oldusername but now belong to newusername. If you moved the directory with the -m flag, everything moves to /home/newusername and the ownership updates automatically.

Permissions on individual files stay the same. If a file was readable and writable before, it still is. If it was restricted, it stays restricted. The change only affects how the system identifies the owner in listings and access checks.

Frequently Asked Questions

Can I change my username while I am logged in?

No. You must log out first or switch to a different user account, because the system cannot rename an account that is currently in use. Log in as root or another user, then run the usermod command.

What if I forget my password and cannot log in to change the username?

Boot into single-user mode or recovery mode, where you have root access without a password. From there, run the usermod command to change the username. The exact steps depend on your boot loader and Kali version, but this is a standard recovery procedure.

Does changing the username affect my sudo permissions?

No. Sudo permissions are tied to your user account in the system files, and usermod updates those references automatically. If you had sudo access before, you still have it after the rename.

Can I change the username of another user on the same system?

Yes, as long as you have root or sudo access. Run sudo usermod -l newname oldname for any user. You do not need to be logged in as that user, but they should not be logged in at the time.

What if the new username I want is already taken?

The usermod command will refuse and tell you the username exists. Choose a different name, or delete the existing user first if it is an old account you no longer need. Use sudo userdel oldaccount to remove a user account.