trying to add a user to a group from the command line but can't figure out how?
Specifically this is on Mac OS X Server 10.5.8
like to add user to 'admin' and 'wheel' groups
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
sudo dseditgroup -o edit -a $username_to_add -t user admin sudo dseditgroup -o edit -a $username_to_add -t user wheel
It's also possible to do this with
dscl, but to do it properly you need to both add the user's short name to the group's
GroupMembership list, and add the user's GeneratedUID to the group's
dseditgroup takes care of both in a single operation.
For those who are looking for the same answer to newer versions of Mac OS, i've found out this:
To add a user to a group, you need this command:
$ sudo dscl . append /Groups/wheel GroupMembership username
I was trying to add my user to the
wheel group, to be able to manipulate the
/Library/WebServer/Documents folder. Besides that, i had to change the permissions to that folder, as by default it is
755. I've changed it to
$ sudo chmod -R 775 /Library/WebServer/Documents
This way i can manipulate the folder content without changing the owner of the folder.
Check out this link:
Adding a user is something easily accomplished using the built in GUI tools that ship with OS X, however any power user can appreciate the possible efficiency gained from using the command line. So in the spirit of efficiency here are the steps necessary to add a user to your Mac OS X system all with our good friend, Terminal.app.
The important bit is here:
Create and set the user’s group ID property.
dscl / -create /Users/toddharris PrimaryGroupID 1000