OSX Commandline User/Group

Add a New Group” similar to groupadd on Ubuntu.

Basically does this sort of thing,

dscl . create /groups/GROUPNAME gid GROUPGID
dscl . create /groups/GROUPNAME passwd '*'
dscl . merge /groups/GROUPNAME users USERNAME

You could also download the GNU OSXUserTools (V1.4) which includes:

  • useradd
  • groupadd
  • groupdel
  • userdel
  • etcpasssync

Add a user to the admin group via command line
Make sure the user’s not already in the group,

niutil -readprop . /groups/admin users

Add a user to the group,

niutil -appendprop . /groups/admin users gneagle

Removing a user from the group:
niutil -destroyval . /groups/admin users gneagle
The modern way to do this is,

sudo dscl -p / -append /Groups/GROUPNAME users USERNAME

For more info, see the poorly-named “How to: Add a user from the OS X command line, works with Leopard!” (which isn’t Leopard specific.)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s