This brief tutorial shows students and new users steps to change their username when using Ubuntu.
People may want to change their username in Ubuntu Linux for many reasons. One common reason is that they may have created or misspelled their account with an undesired name.
Another reason may be to improve security by using a more secure username that is not easily guessed.
Additionally, changing a username may be necessary if a user has changed their legal name or shared their account with another user and wants to differentiate their files and settings.
Whatever the reason, changing a username in Ubuntu Linux can be done with a few simple steps.
To get started with changing your Ubuntu username, follow the steps below:
Restart in recovery mode
To change your username while not logged in, restart Ubuntu in recovery mode and go to the root prompt shell “Drop to the root shell prompt.“
To log in to recovery mode, immediately after powering it on, quickly press either the Shift or Escape key.
At the GRUB screen, choose “Advanced options for Ubuntu.“

Then select Ubuntu recovery mode (usually the second line).

Next, select root (Drop to root shell prompt)

In the root prompt, type these commands:
Change username
First, remount the root:
mount -o remount,rw /
To change the username and home folder name. Replace the new name with the new username and the old name with the current username.
Display Name is the name that shows up on the login screen.
sudo -- usermod -c "Display Name" -l newname -d /home/newname -m oldname
Also, change the group name. The new group should be the same as your username, and the old group should be your current one.
sudo -- groupmod -n newgroup oldgroup
When you’re done, reboot.
sudo reboot
That should do it. You’ll be prompted with the new username when you log in.
DO NOT DO THIS IF YOUR HOME DIRECTORY IS ENCRYPTED!!!!
Conclusion:
Changing your username in Ubuntu Linux can enhance your account’s security and help you better organize your files. Here are the key points to remember:
- Why Change Username?
- To correct misspellings or undesired names.
- To improve security with a more unique username.
- To reflect a legal name change or distinguish account settings when sharing.
- Steps Overview:
- Restart in recovery mode and access the root shell.
- Remount the root filesystem.
- Use command-line commands to change the username and home directory.
- Don’t forget to update the group name to match the new username.
- Reboot the system to apply the changes.
By following these steps, you can successfully change your username in Ubuntu and ensure your account meets your needs.
Leave a Reply Cancel reply