How To Use Usermod Command In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Log in to your Linux system with a user with ‘sudo’ privileges.
2. Run the following command to view the options available with the usermod command:
$ usermod –help
This will display a list of all the available options for the usermod command.
3. To modify a user account, use the following syntax:
$ usermod [options] USERNAME
Replace USERNAME with the actual username of the user you want to modify.
4. Use the options you need to modify the user account.
For example, if you wanted to add the user to a secondary group, you would use the -aG or –append option, followed by the group name:
$ usermod -aG groupname username
5. When you are done, verify the changes by running the following command:
$ id username
This will display all the information about the user, including the groups the user belongs to.