Guide to unix usergroups

I recently put this on my personal blog, copied here incase it is ever useful to any colleagues.

Description Command
Listing available groups groups
Creating a group groupadd groupname
Adding a user to a group adduser username groupname
Listing group members getent group groupname
Listing a users groups groups username
grep username /etc/group
Removing a user from a group gpasswd -d username group


when using /etc/group, the file is in the following format (without spaces)
groupname : password : groupid : members

One Reply to “Guide to unix usergroups”

  1. For listing a users groups, one can also use “id”

    $ id chicken
    uid=41290(chicken) gid=504(dino) groups=504(awesome),506(bird)

Leave a Reply

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