Skip to content

Instantly share code, notes, and snippets.

@skvoz
Created June 8, 2015 14:02
Show Gist options
  • Save skvoz/2f9423ccff1b706570db to your computer and use it in GitHub Desktop.
Save skvoz/2f9423ccff1b706570db to your computer and use it in GitHub Desktop.
Mac OS X : Adding user groups and assigning read/write permission for the group to specific folder
//Adds new user group "dev" using Mac directory service command line utility
sudo dscl . -create /groups/dev
//Assigns some group id for the newly created group
sudo dscl . -append /groups/dev gid 2111
//Assigns password for the group
sudo dscl . -append /groups/dev passwd "xxxxx"
//Adds user with "username" to group "dev"
sudo dseditgroup -o edit -a username -t user dev
//List all the group available, and extract the newly created group 2111
sudo dscacheutil -q group | grep 2111
//To check whether the above entered information are proper, scroll the long list to find the dev group
sudo dscl . readall /groups
//Add the directory to dev group
sudo chown -R :dev /path/to/directory/
//Assigns read/write permission for owner and the members of the group
sudo chmod -R 770 /path/to/directory/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment