The Fastest Way to Change Your Username
The simplest path is to use the Settings app built into Ubuntu 22.04. Open Settings, go to Users, select your account, and click the name field to edit it. This changes your display name — the name that appears on the login screen and in menus — without touching the actual system username that Ubuntu uses behind the scenes.
If you need to change the actual system username (the one you type at the command line), you must use the terminal and log in as a different user or use sudo. This is more involved because Ubuntu will not let you rename the account you are currently logged into. The system username controls file permissions, home directory paths, and how the system identifies you internally, so changing it requires steps that a graphical tool cannot safely perform while you are using that account.
Most people only need to change the display name. Change the system username only if you have a specific reason — such as removing a name you no longer use or standardizing usernames across multiple machines.
Key Takeaways
- Changing your display name in Settings is safe and takes two minutes; it does not affect file permissions or system access.
- Changing your actual system username requires the terminal, a second user account with sudo access, and careful attention to file ownership.
- You cannot rename the account you are currently logged into; you must switch to a different user first.
- After renaming your system username, your home directory path changes, and you may need to update scripts or shortcuts that reference the old name.
Changing Your Display Name in Settings
Your display name is what other people see and what appears on your login screen. To change it, click the system menu in the top right corner (the area with the time and volume controls), then click the power icon and select "Settings".
In Settings, click "Users" in the left sidebar. You may be asked to unlock the panel by entering your password. Find your account in the list and click it. You will see a field with your current name at the top. Click that field and type the new name you want to use. Press Enter to save. The change takes effect when ready, and you will see the new name on your next login screen.
This method changes only how your account appears in the interface. Your system username, home directory, and file permissions remain unchanged. If you share a computer with others or use remote login, they will see your new display name, but the underlying system username stays the same.
Changing Your System Username from the Terminal
Your system username is the name you type when you open a terminal and run the whoami command. It controls your home directory path (usually /home/username), file ownership, and how the system identifies your account internally. Changing it requires the terminal and cannot be done while you are logged into that account.
First, create a second user account with administrator (sudo) access, or use an existing one if you have it. Log out of your current account and log into the second account. Open a terminal and run this command, replacing oldusername with your current system username and newusername with what you want to change it to:
sudo usermod -l newusername oldusername
This renames the account itself. Next, rename the home directory to match:
sudo usermod -d /home/newusername -m oldusername
Wait for the command to finish — it may take a few seconds if you have many files. Then rename the group that owns your files:
sudo groupmod -n newusername oldusername
Log out and log back into your renamed account. Open a terminal and run whoami to confirm the new username is in place. Check that your home directory path is correct by running pwd — it should show /home/newusername.
What Changes When You Rename Your System Username
After you rename your system username, your home directory moves from /home/oldusername to /home/newusername. All your files move with it, and their ownership updates automatically. However, anything that hardcodes your old username will break.
If you have shell scripts, cron jobs, or configuration files that reference /home/oldusername, you will need to edit them to use the new path. Check your .bashrc or .bash_profile files in your home directory for any hardcoded paths. If you use SSH keys, they remain in your home directory and continue to work. If you have set up passwordless sudo or custom permissions for specific commands, those rules may reference your old username and will need updating.
Desktop shortcuts and process launchers that point to files in your home directory will still work because they use the ~ symbol, which always expands to your current home directory. However, any absolute paths you have written down or bookmarked will be outdated.
Undoing a Username Change
If something goes wrong or you change your mind, you can rename your account back using the same process. Log into your second admin account, open a terminal, and run the three commands again, but swap the old and new usernames. For example, if you renamed yourself from alice to bob and want to go back, run:
sudo usermod -l alice bob
sudo usermod -d /home/alice -m bob
sudo groupmod -n alice bob
After you log back into your original account, verify the change with whoami and pwd. Any files or scripts you edited during the first rename will still have the new paths, so you will need to change them back manually.
When You Cannot Log Into Your Second Account
If you do not have a second user account with sudo access, you can create one before renaming your main account. While logged into your main account, open Settings, click Users, and click the + button to add a new account. Set it as an Administrator. Log out, log into the new account, and then follow the renaming steps above using your original account name.
If you have already renamed your account and cannot log in, restart your computer and hold Shift during startup to enter the GRUB menu. Select "Advanced options for Ubuntu" and then "Recovery mode". Choose "Drop to root shell prompt". You will be at a command line as the root user. From there, you can run the usermod and groupmod commands to fix the rename or create a new admin account. This is a last-resort step and should only be attempted if you are comfortable with the terminal.
Frequently Asked Questions
Will changing my username affect my installed programs?
No. Programs installed through the Ubuntu package manager or Snap store are not tied to your username. They will continue to work normally. However, if you have manually installed programs in your home directory or configured them to use your old username path, those may need updating.
What happens to my files if I rename my system username?
Your files stay in your home directory and move with it when the directory is renamed. File ownership updates automatically to your new username. You will not lose any data, but absolute paths in scripts or shortcuts will be outdated.
Can I change my username without using the terminal?
You can change your display name entirely through Settings. If you need to change your actual system username, the terminal is the only method in Ubuntu 22.04. The graphical tools do not expose this option because renaming a system account safely requires careful handling of file ownership and permissions.
Do I need to restart after changing my username?
For display name changes, no restart is needed. For system username changes, log out and log back in to confirm the change took effect. A full restart is not required unless you encounter problems.
What if I use my old username in SSH or remote login?
After you rename your system username, you must use the new username to log in remotely via SSH. Update any saved connection profiles or scripts that reference your old username. Your SSH keys remain valid and do not need to be regenerated.