How To Add User To Different Groups 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. To add a user to a group, use the usermod command. This command has the syntax:
usermod -aG groupname username
2. To view the existing groups available on the system, use the getent command. This command has the syntax:
getent group
3. To add a user to multiple groups, use the usermod command with the -G option. This command has the syntax:
usermod -G group_1,group_2,group_3 username
4. To add a user to a new group, use the groupadd command. This command has the syntax:
groupadd groupname
5. To delete a user from a group, use the gpasswd command. This command has the syntax:
gpasswd -d username groupname