Addgroup on OSX

Blimey, creating a group on OSX is a pain in the butt. Adding users to it even more so.

Don’t use the NetInfo manager gui tool thing… incomprehensible, dangerous IMHO, and the mac help on it is non-existent. addgroup seems to have gone away.

Do use nicl, the Net Information Command Line utility. You’ll need sudo or to be logging as an administrator. All the usual warnings apply, don’t do it if you’re not sure, don’t do it if you’re scared, don’t do it of it’s not your machine, back everythingup, etc, blah, etc.

Create the group

  Find out the next gid. If there’s not one higher than 501 use 501, otherwise add one to the greatest number in this list: nidump group . This will also do it and just return the highest currently used number nidump group . | cut -d: -f3 | sort -n | tail -n 1
  sudo nicl . -create /groups/mygroup
  sudo nicl . -create /groups/mygroup grouppassword \*
  sudo nicl . -create /groups/mygroup gid 508

Append users

  sudo nicl . -append /groups/mygroup users rod
  sudo nicl . -append /groups/mygroup users jane
  sudo nicl . -append /groups/mygroup users freddy
  repeat to fade

Change owner of a folder and all sub folders, files

  sudo chown -vR :mygroup ~/myfolder
This entry was posted in Uncategorized. Bookmark the permalink.

One thought on “Addgroup on OSX

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s