The fastest way to change your Ubuntu username
The quickest method is to use the usermod command in the terminal, which changes your login name without touching your home directory or files. Open a terminal, type sudo usermod -l newusername oldusername, and replace the placeholders with your actual old and new usernames. You will need to enter your password when prompted.
This approach works if you are logged in as a different user or have sudo access. The change takes effect the next time you log in. Your home folder keeps its old name (like /home/oldusername), but your login name and all system records update when ready.
If you want to rename the home directory at the same time — so it matches your new username — you need a second command: sudo mv /home/oldusername /home/newusername. Run this right after the usermod command, while you are still in the terminal.
Key Takeaways
- Use sudo usermod -l newusername oldusername to change your login name from the terminal.
- Your home folder keeps its old name unless you rename it separately with the mv command.
- Log out completely and log back in for the change to take full effect across all applications.
- If you cannot access the terminal, use the graphical Settings app under Users to change your display name (though this does not change your actual login username).
- Changing your username while logged in as that user can cause permission errors; log in as a different user or use a live USB first if you run into trouble.
Why you cannot change the username while logged in as that user
Ubuntu locks your user account while you are actively using it. If you try to run usermod on your own username while logged in, the system will refuse because files are still open and in use. The safest approach is to log out, then log in as a different user (or as root) before running the command.
If you only have one user account and no root password set, you can use a live USB or live CD to boot into Ubuntu without logging in. From there, open a terminal and run the usermod command against your regular user account. This bypasses the lock because your account is not currently active.
Changing your username through the graphical Settings app
Ubuntu's Settings process lets you change your display name (the name that appears on the login screen and in menus), but this is not the same as changing your actual username. The display name is cosmetic; your login username stays the same. This method is useful if you want people to see a different name but do not need to change how you log in.
Open Settings, go to Users, select your account, and click the name field to edit it. Type your new display name and press Enter. The change appears when ready on the login screen and in the top-right corner of your desktop.
If you need to change your actual login username (the one you type at the login prompt), you must use the terminal method described above. The Settings app does not offer this option.
Renaming your home directory to match your new username
When you change your username with usermod, your home folder usually keeps its old name. This can be confusing because your login name no longer matches your folder name. To align them, use the move command: sudo mv /home/oldusername /home/newusername.
Run this command when ready after usermod, before you log out. If you have already logged out and logged back in, log in as a different user first, then run the move command. Do not try to rename the folder while you are logged in as that user, because Ubuntu will lock it.
After renaming the folder, check that your home directory path is correct by opening a terminal and typing pwd. It should show /home/newusername. If it still shows the old path, log out and log back in to refresh the system.
Fixing permission errors after changing your username
Sometimes files in your home directory end up owned by the old username instead of the new one. This happens if the rename did not complete cleanly. You can fix this by running sudo chown -R newusername:newusername /home/newusername, which reassigns all files in your home folder to your new username.
If you see permission denied errors when opening files or running programs, this command usually solves the problem. The -R flag means "recursive," so it updates every file and subfolder at once. After running it, log out and log back in to confirm the fix worked.
Using the usermod command with additional options
The basic usermod command changes only your login name. If you want to change your login name and your home directory path in one step, use sudo usermod -l newusername -d /home/newusername -m oldusername. The -d flag sets the new home path, and the -m flag tells usermod to move your files there automatically.
This combined approach is cleaner than running two separate commands, but it takes slightly longer because the system copies all your files. Make sure you have enough disk space and that no applications are running before you start. Log out completely before running the command, and do not interrupt it while it is working.
What happens to your sudo permissions and group memberships
Changing your username does not automatically remove your sudo access or group memberships. If you were part of the sudo group before the change, you remain in it afterward. The same applies to other groups like docker, audio, or video — your membership stays intact because it is tied to your user ID, not your username.
If you want to verify your group memberships after the change, open a terminal and type groups. The output shows every group your new username belongs to. If you need to add yourself to a group or remove yourself from one, use sudo usermod -aG groupname newusername to add or sudo deluser newusername groupname to remove.
Frequently Asked Questions
Can I change my username without using the terminal?
The Settings app only changes your display name, not your login username. To change your actual login name, you need the terminal and the usermod command. If you are uncomfortable with the terminal, ask someone with Linux experience to run the command for you, or use a live USB to access a terminal environment outside your regular desktop.
What if I forget my password and cannot run sudo commands?
You can boot from a live USB, which gives you a temporary desktop without logging in. Open a terminal from there and run usermod against your regular account. This works because your account is not active, so the system does not lock it. You will need the live USB and physical access to your computer.
Will changing my username affect my installed programs or settings?
Most programs store settings in hidden folders inside your home directory and will find them after the username change. Some older applications that hardcode your username in their configuration files may break, but this is rare. If a program stops working after the change, reinstalling it usually fixes the problem.
Can I change my username back to the old one?
Yes, the usermod command works in both directions. Use sudo usermod -l oldusername newusername to revert. If you renamed your home directory, you will also need to move it back with sudo mv /home/newusername /home/oldusername. The process is identical to the original change.
What is the difference between username and display name?
Your username is what you type at the login prompt and what appears in the terminal. Your display name is what shows on the login screen and in the top-right corner of your desktop. The Settings app changes only the display name. To change your actual username, use the terminal and usermod.