PDA

View Full Version : How do I manage user & groups?


Sunnz
April 28th, 2007, 04:33 AM
Ok so I need to create a new group and add an existing user (myself) to this group.

This is how I usually do it on a nix box:
groupadd -g 8080 mygroup
usermod -G mygroup myuser

But I can't find these commands on OS X...

I tried looking at System Preference but can't find anything like this, how do I manage users & groups on OS X?

fryke
April 28th, 2007, 05:03 AM
NetInfo Manager?

Sunnz
April 28th, 2007, 05:28 AM
Hey thanks, NetInfo is... different!!

fryke
April 28th, 2007, 06:21 AM
I guess it's to freak out beginners. ;)

Sunnz
April 28th, 2007, 06:28 AM
Well I don't know, it feels like regedit on M$, but got that nix touch in it....

bartcatz
May 5th, 2007, 01:25 PM
remember that the directory services store all user and group information. The traditional /etc/group etc are only used in single user mode.

so, you can use the dscl command to create and update groups from the command line (into the directory). such as:

dscl . create /groups/sunnz gid 1000
dscl . create /groups/sunnz passwd '*'
dscl . merge /groups/sunnz users user1 user2

above creates a group 'sunnz' with gid 1000 and adds user1 and user2 to it.

you can check your work in the netinfo manager with:

nidump group . | grep sunnz

Netinfo might be more straightforward! ;)

Sunnz
May 5th, 2007, 01:32 PM
Yea Netinfo seems to be a bit easier...

I mean, what's dscl? Kind of counter-intuitive compared to groupadd and stuff.

bartcatz
May 5th, 2007, 01:42 PM
object oriented mumbo jumbo! dscl is a generic interface for managing the data in the repository. I've used AIX, with it's odm, so I'm kinda used to it. but I use netinfo for this stuff...onry if I was automating a bunch of stuff would I use dscl. onesy twosey is too easy though gui.