usermod/groupmod tools - Rename username and usergroup in Ubuntu

The laptop come with default ubuntu installed.  In that case the username, usergroup they have created by default.  This blog explains you how you can rename the default username and group with your own username, group.

Unix-like operating systems decouple the user name from the user identity, so you may safely change the name without affecting the ID. All permissions, files, etc are tied to your identity (uid), not your username.

To manage every aspect of the user database, you use the usermod tool.  To change username (it is probably best to do this without being logged in):

STEP 1: Reboot your laptop with 1 as a command line parameter.
The laptop will be booted into a rescue mode with 1 as a parameter.  You can also boot your laptop in a single user mode.

STEP 2: Change your root password with the command "passwd"
This is just tobe secured in future,  because one can easily hack your laptop with your default user password.

STEP 3: Rename oldUsername with newUsername

# usermod -l newUsername oldUsername

This however, doesn't rename the home folder.

STEP 4: Rename to newHomeDir
To change home-folder, use

# usermod -d /home/newHomeDir -m newUsername

after you changed the username.

STEP 5: Rename the groupName

# groupmod --new-name NEW_GROUP_NAME OLD_GROUP_NAME

Now you can reboot your laptop in multiuser mode and log-in as a new user which is being prompted.




Comments

Popular posts from this blog

Apache Ambari on ARM64

Benchmarking BigData

mockbuild warning in CentOS