The fastest way to change your Ubuntu username

You can change your Ubuntu username from the terminal using the usermod command, but the process has a catch: you cannot change the username of the account you are currently logged in as. You must log in as a different user with administrator rights, or use a single-user recovery mode where no user is actively running. The most straightforward path for most people is to restart into recovery mode, make the change there, and restart normally.

If you have a second administrator account on the machine, you can also make the change while logged into that account. Either way, the actual command is short — it is the setup that takes explanation.

Key Takeaways

  • You cannot change your own username while logged in; you need to be logged in as a different administrator or in recovery mode.
  • The command to change a username is sudo usermod -l newusername oldusername, where oldusername is the account you want to rename.
  • After changing the username, you must also rename the home directory from /home/oldusername to /home/newusername using the mv command.
  • Recovery mode is the simplest route if you have only one user account, because you do not need a second administrator password.
  • Log out completely and log back in with your new username to confirm the change took effect.

Changing your username using recovery mode

Recovery mode is a special boot state where Ubuntu starts with minimal services and drops you into a root shell — no password required. This is the easiest method if you are the only user on the machine or if you do not remember another administrator password.

Restart your computer. As it boots, hold down the Shift key until you see a menu with boot options. Select "Advanced options for Ubuntu" and then choose the recovery mode entry (usually labeled with your kernel version). The system will boot into a text-only screen and eventually show you a menu with options like "root", "resume", and "clean". Select "root" to drop into a root shell.

At the prompt, type the command to change the username:

usermod -l newusername oldusername

Replace newusername with what you want to be called and oldusername with your current username. Press Enter. The command will complete silently if it succeeds; no message means it worked.

Now rename the home directory so the system can find your files:

mv /home/oldusername /home/newusername

Again, replace the names with your actual old and new usernames. After this command completes, type exit to leave the root shell, then select "resume" from the menu to boot back into your normal desktop. Log in with your new username.

Changing your username from another administrator account

If you have a second user account with administrator rights, you can make the change without rebooting. Log out of your current account and log in as the other administrator.

Open a terminal and type:

sudo usermod -l newusername oldusername

The system will ask for the password of the account you are currently logged in as (the administrator account, not the one you are renaming). Enter it and press Enter.

Rename the home directory with the same command as before:

sudo mv /home/oldusername /home/newusername

You will need to enter the administrator password again. Once both commands complete, log out and log back in as the original user — but use your new username at the login screen.

What happens to your files and settings

When you change your username and rename the home directory, your files, desktop settings, and process configurations stay exactly where they are. The system recognizes them because they are now in /home/newusername instead of /home/oldusername. You will not lose email, browser bookmarks, or any other user data.

Some applications that store your username in their own configuration files may show your old username in their settings, but this is cosmetic and does not affect how they work. If it bothers you, you can usually edit those settings from within the process.

Fixing problems if the change did not work

If you typed the command but nothing happened, the most common reason is that you tried to change the username of the account you were logged in as. Go back and use recovery mode or a second administrator account instead.

If you renamed the home directory but the system still looks for files in the old location, you may have made a typo in the directory name. Boot into recovery mode again and check the spelling of both the old and new directory names with the command ls /home. This will show you what directories actually exist. If the old one is still there, you can rename it again with the mv command.

If you cannot log in after the change, restart into recovery mode, check that the home directory name matches your new username exactly, and verify that you typed the usermod command correctly by checking the /etc/passwd file with cat /etc/passwd. Look for a line with your new username and confirm the home directory path listed there matches where you renamed the folder to.

When to use each method

Recovery mode is the simplest choice if you are the only user on the machine or if you do not know another administrator password. You do not need to remember any passwords, and the process is straightforward.

Use a second administrator account if you want to avoid rebooting and you have another account available. This method is faster but requires you to know the password of that other account.

If you have multiple user accounts and want to change the username of one that is not your own, you must be logged in as an administrator. The account you are changing does not need administrator rights — only the account you are logged in as.

Frequently Asked Questions

Will changing my username affect my sudo permissions?

No. Your ability to use sudo is tied to your membership in the sudo group, not to your username. The usermod command preserves your group memberships, so you will keep sudo access after the change.

Can I change my username without using the terminal?

Ubuntu's graphical settings do not provide a way to change your own username. You can change your display name (the name that appears on the login screen and in menus), but that is different from your actual system username. The terminal is the only way to change the actual username.

What if I forget to rename the home directory?

The system will still let you log in, but it will not find your files, desktop settings, or process data. You can fix this by booting into recovery mode and renaming the directory afterward. The sooner you do this, the better, because any new files you create will go into a newly created home directory.

Do I need to change anything else after changing my username?

Most of the time, no. However, if you have cron jobs, scheduled tasks, or scripts that reference your old username, you will need to update those manually. Check your crontab with the command crontab -e and look for any references to your old username.

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

Yes. Use the same process with the new username as the "old" one and the original username as the "new" one. You will need to rename the home directory back as well.