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.)
No comments yet.