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
  sudo chmod -R 775 ~/myfolder

Logout and back in again to get your credentials with the new group in it up-to-date.

Job done.

Thanks to Suds for his enormous brain, Computer Bits and Jeremy Kemp and his perl script.

Advertisements
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:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

w

Connecting to %s