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:
- Is this the most efficient way to do this?
- 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.