Group Management

groups

Print the group membership of a user.

dscl

Create, modify, and delete groups.

A group is a set of accounts treated as a single entity. If you give permission for a group to take some action (such as modify a file), then all members of that group can take it. For example, you can give full permissions for the group friends to read, write, and execute the file /tmp/sample:

groups
users smith friends
➜ chgrp friends /tmp/samplechmod 770 /tmp/samplels -l /tmp/sample
-rwxrwx---  1 smith friends  2874 Oct 20 22:35 /tmp/sample

To add users to a group, use dscl. To change the group ownership of a file, recall the chgrp commands from File Properties.

Get Macintosh Terminal Pocket Guide 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.