Which Groups Belong To A User In Linux

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM

How to find the user or myself belongs to which group? Because group is important for the folder and device access permissions. One user can be join multiple or single group. We can get our current group membership or another user group membership.

Who Am I?

First when we log in a system we may want to get our username and user account related information. We will use whoami command.

Who Am I?

Who Am I?

Print User Group Names

I can get my group membership by using groups command without providing any parameter. We will use groups command to print current user group name.

My Group Memberships

My Group Memberships

  • As we expected root user is in the root group

Another User Group Membership

I want to get other user group membership. There is no need for parameter. We will use groups command and provide the user we want to print.

Another User Group Membership

Another User Group Membership

  • groups will give group membership information of test2
  • test2 is the user we want to get group membership
  • mysql and root are group names of the test2 joined

RSS
FACEBOOK
FACEBOOK
PINTEREST
PINTEREST
LINKEDIN
INSTAGRAM
LEARN MORE  Linux Su Command Tutorial With Examples

Leave a Reply

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

Enjoy this blog? Please spread the word :)