
Follow ZDNET: Add us as a favorite source On Google.
Usermod command is low for user modification, and, as the name means, allows you to modify various aspects of the user account.
For a Linux Administrator, this command is important. For Linux users, the command is mostly useful, especially what it can do.
Let’s immerse this rabbit hole down and see what the Linux is with the Uusmarod command.
1. Change user details
When you make with a Linux user Add user The command, you can include some details to go with the new user (such as full name, office and home phone number, and other information, which can be used as a details. After creating the user, the only way to change or add such information is through a usermode command. For example, you want to add a comment to the user.
Sudo Usermod -C “Information” User
Too: 5 Surprisingly productive things that you can do with Linux Terminal
Where the information is what you want to add, and the user is the user account you want to change.
This can be easier if you have two users with the same first name and you want to separate them in their user information.
2. Change a user name
You can also change a user name. Before you do this, know that it does not change the user’s home directory name. So if I have a user Sam and I want to convert it into a Samantha, Shatter There is to help me such an order will look like this:
Sudo Rumerod -L Samantha Sam
-L option is for login name.
3. Change the name of a home directory
After changing a user name, you can change the name of the user’s home directory. Before you do this, you have to make sure that the user is logged out; Otherwise, it can wreak havoc on their account (or their data). You also need to ensure that the user’s data is added to the new home directory (otherwise, the user winds up with an empty house). To change a directory name (and add data), you will use a command in this way (sticking with our Sam/Samantha example):
Sudo Usermod -D /Home /Samantha -M Sam
-D option sets the new home directory path, and -M option moves data.
Too: There is a new best Linux distribution that is ready to wow you
4. Lock and unlock the user account
There may be times when you need to lock a user out of their account (and later allow them to return). It can be used for temporary employees or grounded children. To lock the user account, the command will be:
Sudo usermod -L user
Where the user has a user name, on which the lock is applied.
To unlock the account, you will release the command:
Sudo usermod -U user
Where the user has a user account.
6. Change user’s account expiration date
Do you know that you can eliminate a user account in Linux? Suppose you have a temporary employee, whose contract ends on October 31, 2025. If you want to set a person’s user account to end on that date (instead of remembering it inste Shatter like so:
Sudo usermod-e 2025-10-31 users
Where the user has a user account name.
7. Add a user to a group (or group)
I have had to use this facility many times. For example, I use Docker a lot, and when I install it, I will have to add users to the group (otherwise it will not work for them without using the curb, which may lead to safety issues). You must have also created a group that will be used by several accounts to reach a specific folder. Suppose you have created an editorial group and want to add Sam to it. The order for this will be:
Sudo Rumerode -AAG Editorial Sam
Too: 7 Linux Terminal Basics should learn first to every beginner – and why
8. Modify the user’s home directory
If you have changed the name of the user account, you will see that their home directory is still listed as the original user name. If you want to change the name of the user’s home directory (to avoid confusion), then your back is in the usermod. Before you do this, however, it is important that you make sure that the user is logged out of their account (otherwise, it can cause serious problems).
To change the name of the user’s home directory, the command will be:
Sudo Usermod -D /Home /Newname Oldname
Where the new name for the newname directory and Oldname is the current name.
9. Change the user’s shell
The possibility is very thin that you will need to do so at any time, but you can change the user’s shell. Suppose you want to transform Samantha’s shell from bash to Zsh. To do this, you must first make sure that the new shell is actually installed with the command:
Cat /etc.
If ZSH is listed, you can change it to the socialist with the following order:
Sudo Rumerod -S /bin /Shell Samantha
Want to follow my work? Add ZDNET as a reliable source on google,

