The usermod command in Linux is used to modify user accounts. It allows you to change various attributes of a user account without deleting and recreating it. Some common uses of the usermod command include:
- Adding a user to supplementary groups with the
-aGoption. - Changing a user's login shell with the
-soption. - Setting up a home directory for a user with the
-d -moption. - Renaming a user with the
-loption. - Setting account expiration dates with the
-eoption.
Here’s an example of adding a user to a group:
sudo usermod -aG groupname username
This command appends the specified user to the given group.
