Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have three goals:

  • Implement the "FakeGroup" fix
  • Add a group with a specific GID (i.e. customgroup with GID 1111)
  • Add a user to that group

Implement the "FakeGroup" fix

According to this document, NFS Shares on Mac OSX Lion ignore certain group memberships. See the code below:

dscl . -create /Groups/FakeGroup GeneratedUID FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
dscl . -create /Groups/FakeGroup PrimaryGroupID 345678
dscl . -create /Groups/FakeGroup RealName "Fake Group"
uguid=$(dscl . -read /Groups/MyUSERNAME GeneratedUID | awk '{print $2}')
dscl . -create /Groups/FakeGroup NestedGroups $uguid

I'm receiving this error:

<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)

Not sure what GeneratedUID is supposed to be, but if I just type "id", is this my uid=MYUID(myUserName)?

So wouldn't this essentially work:

dscl . -create /Groups/FakeGroup GroupMembership UserName 

I'm not entirely sure, but I was told this fix is needed for NFS shares to properly work.

Add a group with a specific GID (i.e. customgroup with GID 1111)

I've written a short script to take groupName and groupGID - it created the group with the specified GID. Then it asks which user you would like to add to that group.

echo "What group name would you like to create [ENTER]"
read groupName

echo "What GID would you like to assign to $groupName?"
read groupGID

dscl . -create /Groups/$groupName
dscl . -create /Groups/$groupName name $groupName
dscl . -create /Groups/$groupName passwd "*"
dscl . -create /Groups/$groupName gid $groupGID

echo "Which user would you like to add to your newly created group?"
read userName

dscl . -create /Groups/$groupName GroupMembership $userName

This script works perfectly for what it was written for. It adds the specified user to the newly created group with the specified GID on that group. You can verify with:

dscl . readall /Groups

My questions:

  1. Is this the most efficient way to do this?
  2. Is this the right way to create a fix for NFS share reading and writing?

If anyone has any input, it would be greatly appreciated. I haven't found a solid source that has all of this information in one shot to create a group with a custom GID, add the user, and the fakegroup fix.

share|improve this question

If you read the document you linked very carefully, you'll note the following:

Note, in the above command we are using the group called 'user' for a group that all users are a member of

so you're probably not referring to an existing group here:

uguid=$(dscl . -read /Groups/MyUSERNAME GeneratedUID | awk '{print $2}')

Take a look at any existing group using

dscl . read /Groups/everyone

And note the value for GeneratedUID. It is not a simple number like the GID (PrimaryGroupID), but a GUID/UUID.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .