You can find out to what groups a user belongs.

To find out what groups someone belongs to, use the groups command . For example, if I wanted to know what groups I belong to, I could run the groups command with no arguments:

    % groups
    ora staff book dmg

I belong to the groups ora, staff, book, and dmg.

To find out the groups that another user belongs to, type their login name as an argument to the groups command:

    % groups frank
    frank: ora prod editors book

On some systems (BSD-based systems), you belong to all your groups all the time. That is, Frank can access a file that belongs to prod and then another file that belongs to editors without having to change anything. On other systems, you can only belong to one group at a time, and you have to use the newgrp command to change groups (and possibly also type in a password for the new group).

Only the system administrator can add or delete users from a group.

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.