Linux is a multi-user operating system. And with this feature comes the responsibility of managing every user on the system. The administrator needs to ensure that each user has proper permissions, distinct user IDs, unique user names, etc.

But what if you desire to change the data associated with a particular user? Does Linux allow anyone to modify such sensitive details easily? The usermod command is the respond to all these questions.

This article will demonstrate how you can modify your username on Linux, along with a detailed guide on modifying the user ID and home directory of a user.

Change a Username on Linux

On Linux, the /etc/passwd file stores the information associated with users. Although you can change the user details directly by editing the passwd file, it is not a recommended practice since it can lead to diverse issues on your organization.

You can use the usermod utility provided by Linux to perform operations related to user management and moderation. The usermod command even allows you lot to change the username of a user on Linux.

Annotation that you must take access to a superuser account to effect these commands successfully. If y'all don't have the authorization, you tin can ask your system administrator to add you to the sudoers list.

To modify the username, use the -l flag with usermod:

          usermod -l newusername oldusername        

For example, to change the username of the user "makeuseof" to "muo":

          usermod -fifty muo makeuseof        

Rename the Home Folder

Irresolute the username on Linux using the aforementioned command doesn't modify the dwelling directory of that particular user. Use the -d flag if you want the habitation folder to reflect the changes made to the username.

To rename the home directory of the user muo:

          usermod -d /home/muo -thou muo        

To verify if the same control works, head over to the home directory and locate the folder named muo.

Assign a New User ID to a User

Apart from irresolute the username, the usermod command also allows yous to assign a new and unique UID to any user. The UID is a non-negative integer starting from naught. UIDs between the range 0-99 are reserved for system users.

To alter the user ID on Linux using usermod:

          usermod -u uid username        

...where uid is the user ID that y'all want to assign to the user named username.

When you alter the UID, the system will add together the new UID equally the owner of all the files and folders present in the /abode directory of that particular user.

Note that the user will take to modify the owner details of any files outside the /home directory.

Change a User's Display Name

The username and user ID are important for identifying a item user on the system. Apart from these ii, Linux also stores additional "finger information" related to users in the /etc/passwd file. This information includes the display proper noun, office telephone, and work telephone of the user.

Although users take a complete option whether they want to provide such information, Linux allows you to change or remove these details anytime you want.

Yous can modify your business relationship'due south brandish proper noun using either usermod or the chfn command.

Using the usermod Command

Specify the -c flag along with the usermod control to change the display proper noun:

          usermod -c "Get-go Last" username        

For instance, if you want to change the display name of the user muo:

          usermod -c "Make UseOf" muo        

Using the chfn Command

Changing the brandish proper noun using the chfn control is simple:

          sudo chfn -f "Get-go Last" username        

To modify the display proper name of the user makeuseof:

          sudo chfn -f "Brand UseOf" makeuseof        

Managing User Information on Linux

Since Linux offers so many options related to user management, the demand for a special user with elevated privileges is obvious. That is why, every Linux organization has a root user, or a superuser, that controls and monitors the activities of other users on the organization.

To add together an extra layer of security and ensure that every user is isolated from the residuum, Linux offers the choice to add a password to your business relationship. If y'all take already set up a weak countersign without giving much thought, consider changing information technology to enhance the security of your account.

How to Change Your Linux Password

Read Next

Near The Writer