2 Answers
2

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 GroupMembers list. dseditgroup takes care of both in a single operation.

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.

tried it with sudo dscl . -append /Groups/admin GroupMembership username and though it added the user to "admin" but it also added a bunch of other groups like com.apple.sharepoint.group.1 and com.apple.access_screensharing ect... ?!?
–
MeltemiNov 23 '10 at 3:01

That is strange. On the other hand, perhaps these are groups that have been associated with that user, or it somehow inherited them from elsewhere.
–
user3463Nov 23 '10 at 3:13

Did you read through the man pages for dscl at all?
–
user3463Nov 23 '10 at 3:17