The fastest way to change your Kali username

The simplest 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

You will be prompted for your password. After you press Enter, your username changes when ready. Your home folder stays at /home/oldusername, but you can log in with the new name. This is the route most people should take because it leaves everything else untouched.

If you also want to rename your home directory to match your new username, you will need a second command after the first one completes. That process is covered in the section below.

Key Takeaways

  • The usermod command changes your login name without moving your files or breaking permissions.
  • You must run usermod with sudo, and you cannot change the username of the account you are currently logged into — you need a second admin account or boot into single-user mode.
  • Your home directory keeps its old name by default, which is usually fine, but you can rename it separately if you want everything to match.
  • After you change your username, log out completely and log back in to confirm the change took effect.

Changing your username when you cannot use sudo

If you are the only user on the machine and you cannot run sudo commands, you will need to boot into single-user mode. Restart your computer and hold down the Shift key during startup to open the GRUB menu. Select the entry that says "recovery mode" or shows a single-user option.

Once you are in single-user mode, you have root access without needing a password. Type the usermod command exactly as shown above, but without the sudo prefix:

usermod -l newusername oldusername

After the command completes, type exit to return to normal boot. This method works when you have forgotten your sudo password or when your account does not have sudo rights.

Renaming your home directory to match your new username

After you change your username with usermod, your home folder still has the old name. Most of the time this does not cause problems — Kali will find your files either way. But if you want everything to match, you can rename the directory.

First, make sure you are logged out of the account you just renamed. Log in as a different user with sudo rights, or boot into single-user mode. Then run:

sudo mv /home/oldusername /home/newusername

This moves your entire home directory to the new location. After you run this command, log in with your new username. Your files, settings, and permissions will all be in the right place.

If you skip this step, you can still use your account normally — Kali will create a new home directory at /home/newusername the first time you log in, and your old files will remain at /home/oldusername. You can move them manually later if you decide you need them.

What happens to your files and permissions

When you use usermod alone, your files keep their old owner name in the system until you rename the home directory. You can check this by opening a terminal and typing ls -l in your home folder — the owner column may still show your old username. This is harmless and does not prevent you from reading or editing your files.

If you rename the home directory with the mv command, all files automatically belong to the new username because they move as a unit. Your file permissions stay exactly the same — you keep read and write access to everything you owned before.

The only time you might run into trouble is if you have scripts or configuration files that hardcode your old username as a path. These are rare in a standard Kali installation, but if you have written custom scripts, you may need to update the paths inside them.

Changing your username back if something goes wrong

If you change your username and then realize you made a mistake, you can change it again using the same usermod command. Just swap the old and new names:

sudo usermod -l originalusername newusername

This works even if you renamed your home directory — the directory name does not have to match your username for the system to work. If you want to rename the directory back as well, use the mv command again with the paths reversed.

The only situation where you cannot easily undo a username change is if you have already deleted the old home directory or if you are locked out of sudo access. In those cases, you would need to boot into single-user mode or create a new admin account to fix things.

Why you might not want to rename your home directory

Leaving your home directory at /home/oldusername while using a new username is a valid setup. Many system administrators do this because renaming a home directory can occasionally break things if you have installed software that stores absolute paths to your home folder.

The trade-off is that your directory listing looks mismatched — your username is new but your home folder has the old name. This is purely cosmetic and does not affect how Kali works. If you are not sure whether renaming is safe for your setup, it is better to leave the directory alone and only change your username.

Frequently Asked Questions

Can I change my username while I am logged in?

No. You cannot change the username of the account you are currently using. You must either log in as a different user with sudo rights, or boot into single-user mode. If you try to run usermod on your own account while logged in, you will get an error saying the user is currently in use.

What if I forgot my old username?

You can find your current username by opening a terminal and typing whoami. If you are logged in, this shows your username when ready. You can also look in /home to see what directory names exist — those are your user accounts.

Does changing my username affect my sudo rights?

No. Your sudo permissions are tied to your user account, not to the name. After you change your username, you will still be able to run sudo commands the same way you did before. You do not need to reconfigure sudoers.

Will my installed programs still work after I change my username?

Yes. Most programs in Kali do not care what your username is. The only exception is if you have installed software that hardcodes your home directory path in its configuration. This is uncommon, and you would only notice it if a specific program stops working after the change.

Can I change my username to something with spaces or special characters?

Technically yes, but you should not. Linux usernames work best with lowercase letters, numbers, and underscores only. Spaces and special characters can break scripts and cause confusion in the terminal. Stick to straightforward names like "alice" or "alice_work".