mac

How do I create a group in Mac OS X?

    Creating Groups

Creating groups can be a useful feature so you can grant specific users access to certain files.

Let’s say that you have a directory for Apache called /apps/apache/htdocs that’s owned by the www user. If you want the people who manage the content in /apps/apache/htdocs to be able to create and modify files, you can add them to a new group and change the group ownership of /apps/apache/htdocs to allow them to make changes.

1. dscl . create /Groups/webadmins (Create the group)
2. dscl . create /Groups/webadmins RealName “Web Admins” (Create the group description)
3. dscl . create /Groups/webadmins gid 500 (Set the group ID)
4. dscl . create /Groups/webadmins GroupMembership user1 (Add user1 to the webadmins group)
5. dscl . append /Groups/webadmins GroupMembership user2 (Append the group to add user2 to the group)

Now to take advantage of the new group using our example, you would do the following:

1. chown -R /apps/apache/htdocs :webadmins (Recursively change all files in /apps/apache/htdocs to be owned by webadmins)
2. chmod -R g+rw /apps/apache/htdocs (Recursively change the permissions of files in /apps/apache/htdocs to be group readable and writable)

Click to comment

Leave a Reply

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

To Top