Many Linux commands can do more than you might think. The usermod command is one such command, and it can be very handy.
The usermod command is short for user modification, and, as the name implies, allows you to modify various aspects of a user account.
For a Linux administrator, this command is crucial. For Linux users, the command most certainly comes in handy, especially given what it can do.
Let’s dive down this rabbit hole and see what’s what with the Linux usermod command.1. Change user details
When you create a Linux user with the adduser command, you can include certain details to go along with the new user (such as full name, office and home phone numbers, and other information, which can be used as a description. After you’ve created the user, the only way to change or add such information is via the usermod command. Say, for instance, you want to add a comment for a user. To do that, you would issue the command:
sudo usermod -c «INFORMATION» USER
Where INFORMATION is what you want to add, and USER is the user account you want to change.
This can be handy if you have two users with the same first name and you want to differentiate them in their user information. 2. Change a username
You can also change a username. Before you do this, know that it does not change the user’s home directory name. So if I have the user sam and I want to change it to samantha, usermod is there to help me. Such a command would look like this:
sudo usermod -l samantha sam
The -l option is for the login name.
Домой
United States
USA — software Need to modify user accounts in Linux? This is the command for...