Add a User to a Group

Add an Existing User Account to a Group

usermod -a -G examplegroup exampleusername

Change a User’s Primary Group

usermod -g groupname username

View current user’s groups

groups

To view the numerical IDs associated with each group, run the id  command instead:

id

View groups of another user:

View groups of another user:

groups exampleusername
id exampleusername

View all groups of the system:

getent group

Leave a Reply

Your email address will not be published. Required fields are marked *