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 |
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.
Like this:
Like Loading...
Related
nicl and all other netinfo-tools are deprecated with Leopard, see
http://developer.apple.com/mac/library/releasenotes/MacOSXServer/RN-DirectoryServices/index.html
Use dscl instead.
—
Greets, Frank