How to Change Username in Ubuntu Linux

|

|

This tutorial guides students and new Ubuntu users on how to change their username. Unlike Windows, one cannot change the account name while logged into Ubuntu; a different user with root permissions is needed. While it’s common to log in as root for this task, this tutorial offers an alternative method, which involves restarting in…

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 their account with an undesired name or misspelled it.

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 if they have shared their account with another user and want 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, simply 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:

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:


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



One response to “How to Change Username in Ubuntu Linux”

  1. Martin Makella Avatar
    Martin Makella

    It works fine, thank you. It saved me a lot of time and hassle.
    reccomended !!!

Leave a Reply to Martin MakellaCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Discover more from Geek Rewind

Subscribe now to keep reading and get access to the full archive.

Continue reading