This brief tutorial shows students and new users steps to change one’s username when using Ubuntu.
Unlike Windows, you can’t be logged in to Ubuntu while changing your username or account name. You must login as a different user with root permissions to able change an account name.
There are many tutorial that tell you to login as the root user, then change the username of the account you want to replace.
Although logging in as root to change an account username will work, this post will show you a different method that should also work without logging in as root.
If you’re a student or new user looking for a Linux system to start with, the easiest place to start is Ubuntu Linux OS. It’s a great Linux operating system for beginners and folks looking for easier Linux distribution to use.
Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices.
To get started with changing your Ubuntu username, follow the steps below:
Restart in recovery mode
To change your username while not logged in, simply restart Ubuntu in recovery mode and go to the root prompt shell “Drop to root shell prompt“
To login to recovery mode, immediately after powering it on, quickly press either the Shift or Escape key.
At 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:
First remount the root:
mount -o remount,rw /
To change the username and home folder name. Replace newname with the new username and oldname with the current username.
Display Name is the name that shows up on the logon screen.
sudo -- usermod -c "Display Name" -l newname -d /home/newname -m oldname
Also, change group name. The newgroup should be the same as your username and oldgroup should be the same as your current username.
sudo -- groupmod -n newgroup oldgroup
When you’re done, reboot.
That should do it. When you login back in, you’ll be prompted with the new username.
DO NOT DO THIS IF YOUR HOME DIRECTORY IS ENCRYPTED!!!!
This post showed you how to change your username when using Ubuntu. If you find any error above, please comment below.
You may also like the post below: