The fastest way to change your Ubuntu 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 asked for your password. After you enter it, your username changes when ready. Your home folder stays at /home/oldusername, which is fine — the system knows who you are by your user ID number, not the folder name. If you want the folder name to match your new username, you can rename it afterward with a second command, but this step is optional and not necessary for the system to work.

Key Takeaways

  • The usermod -l command changes your username in one step and requires only your password.
  • Your home folder name does not have to match your username — the system identifies you by a number, not a name.
  • If you want to rename your home folder to match your new username, you must do this as root using the mv command.
  • You cannot change the username of the account you are currently logged into — you must use a different account or boot into recovery mode.
  • Changing your username does not affect your files, permissions, or installed programs.

Why you cannot change your own username while logged in

Ubuntu will not let you change the username of an account you are actively using. The system locks user accounts during login to prevent conflicts. 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.

The solution is to switch to a different account first. If you have another user account on the machine with administrator rights, log out and log into that account, then run the usermod command on your original username. If you do not have a second account, you can create one temporarily, or you can boot into recovery mode and change the username from there.

Renaming your home folder to match your new username

After you change your username with usermod, your home folder still has the old name. This is not a problem — the system does not care. But if you want the folder name to match, you need to rename it. This requires root access and must be done while you are not logged in as that user.

Log in as a different user or boot into recovery mode. Then run this command, replacing the old and new names:

sudo mv /home/oldusername /home/newusername

After the folder is renamed, you should also update the home directory setting in the user account. Run this command:

sudo usermod -d /home/newusername -m newusername

The -m flag tells the system to move the contents of the old home directory to the new location. After this, everything is aligned — your username, your home folder name, and the system's record of where your home folder is.

Changing your username using recovery mode

If you do not have a second user account, recovery mode is the easiest path. Restart your computer and hold down the Shift key as it boots. You will see a menu. Select "Advanced options for Ubuntu" and then choose the recovery mode option (usually labeled with your kernel version).

The system will boot into a minimal environment with a root prompt. You do not need to enter a password. From here, you can run the usermod command on any account, including your own, because you are not logged in as that user. Type the command exactly as shown above, then type exit and select "Resume" to go back to the normal desktop.

What happens to your files and permissions

Changing your username does not touch your files, folders, or permissions. Everything you own stays owned by you — the system tracks ownership by your user ID number (called a UID), not by your username. When you list files with ls -l, you will see your new username next to your files, but the files themselves have not moved or changed.

Your sudo access, group memberships, and installed programs all stay the same. If you had permission to do something before the change, you have permission to do it after. The only thing that changes is the name the system displays when you log in and when you run commands.

Changing your display name separately from your username

Your username (the name you type to log in) is different from your display name (the name that appears in menus and notifications). If you only want to change how your name appears in the interface, you can do that without touching your username. Open Settings, go to Users, click on your account, and change the "Full Name" field. This does not affect your login name or your home folder.

This is useful if you want to keep your username short and technical but have a longer, friendlier name show up in the system. For example, your username could be jsmith but your display name could be John Smith.

Frequently Asked Questions

Will changing my username break my programs or settings?

No. Programs and settings are stored in your home folder and linked to your user ID, not your username. After you change your username, everything works exactly as before. You will not need to reinstall anything or reconfigure your programs.

Can I change my username without using the terminal?

Ubuntu's graphical settings do not include a username change option. You must use the terminal and the usermod command. This is by design — changing a username is an uncommon task that requires care, so the system does not expose it in the regular settings menu.

What if I forget my old username?

You can see all usernames on the system by opening a terminal and typing cat /etc/passwd. Look for lines that start with a name followed by a colon. Your username is the first part. You can also see it by typing whoami while logged in.

Do I need to change my password after changing my username?

No. Your password is stored separately from your username and does not change. You log in with your new username and your old password. If you want to change your password at the same time, you can run passwd in the terminal, but it is not required.

Can I change my username back if I change my mind?

Yes. Run the same usermod command with the new username as the old one and your original name as the new one. If you renamed your home folder, you will need to rename it back as well. There is no risk — changing your username is completely reversible.