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, but you can rename that folder too if you want it to match your new username — that step is optional and comes later.
This method works whether you are logged in or not, and it does not affect your files, permissions, or settings. If you only need the username to change and nothing else, you are done.
Key Takeaways
- The usermod -l command changes your username in one line and leaves all your files and permissions untouched.
- You must use sudo to run the command, which means you need administrator access or a password in the sudoers file.
- Your home folder keeps its old name after the username changes; renaming it is a separate optional step.
- If you want your home folder name to match your new username, you must rename it while logged in as root or from another user account.
- Logging out and back in shows your new username everywhere in the system.
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 does not break anything, but many people want the folder name to match. To rename it, you cannot be logged in as that user — you must switch to root or log in as a different user first.
The safiest way is to boot into recovery mode. Restart your computer, hold down Shift during startup to see the GRUB menu, select "Advanced options for Ubuntu", then choose "Recovery mode". You will see a menu with several options; select "root" to open a root shell.
Once you have a root prompt, run this command, replacing the old and new names:
mv /home/oldusername /home/newusername
Then type exit and select "Resume" from the menu to go back to normal mode. When you log in with your new username, your home folder will have the matching name.
Changing your display name separately from your login username
Ubuntu also has a display name, which is what appears in the top panel and login screen. This is different from your login username. If you only want to change how your name appears on screen — for example, from "jchen" to "James Chen" — you do not need to use the terminal at all.
Open Settings, go to Users, click on your account, and look for a "Full Name" or "Display Name" field. Click it and type the name you want to see. This change takes effect the next time you log in. Your login username stays the same, so all your files and permissions remain exactly as they were.
This is useful if you set up your account with a short username but want a more formal name displayed in menus and notifications.
What happens to your files and permissions
When you change your username with usermod -l, your files keep the same owner — they are still owned by the same user ID number, not by the username itself. Linux uses numbers behind the scenes, so changing the name does not break anything. You will still own all your files and be able to read and write them normally.
If you also rename your home folder, make sure you do it while logged in as root or another user, not while you are logged in as the account being changed. If you rename the folder while logged in as that user, some programs may not find your settings or files.
Undoing a username change
If you change your username and then realize you made a mistake, you can change it back the same way. Run usermod -l again with your new username as the "old" name and your original username as the "new" name. There is no undo button, but the process is reversible.
If you also renamed your home folder and want to undo that, boot into recovery mode again and use the mv command to rename it back.
When you need administrator access to make changes
All username changes require sudo access. If you are not in the sudoers file, you cannot run these commands. On a personal computer where you set up the account yourself, you almost certainly have this access. On a work or school computer, you may not — in that case, contact your IT department or system administrator.
If you have forgotten your password, you can still change your username by booting into recovery mode and selecting the root shell, which does not ask for a password. This is one reason recovery mode exists.
Frequently Asked Questions
Do I have to rename my home folder after changing my username?
No. Your home folder can keep its old name and everything will work fine. Renaming it is only if you want the folder name to match your new username for tidiness. Your files, settings, and permissions do not depend on the folder name.
Will changing my username break my installed programs?
No. Programs do not care about your username — they care about file paths and user ID numbers, both of which stay the same. After you change your username and log back in, all your programs will work exactly as before.
Can I change my username without using the terminal?
The Settings app does not have a built-in option to change your login username. You must use the terminal and the usermod command. However, you can change your display name (the name shown on screen) through Settings without touching the terminal.
What if I am logged in when I try to change my username?
The usermod -l command will still work while you are logged in, but you should log out and back in afterward so the system updates everywhere. If you also want to rename your home folder, you must log out first or use recovery mode, because you cannot rename a folder while it is in use.
How do I know if the username change worked?
Open a terminal and type whoami. It will print your current username. If it shows your new username, the change worked. You can also look at the top-right corner of the screen or the login screen next time you restart.