Tuesday, September 18, 2007

Adding a user to a group on a mac

Mac OsX does not use the usual Unix user and group administration tools. It has it's own application - called netinfo (see man netinfo) and a gui for that, called Netinfo Manager and located in /Applications/Utilities. You need to have administrator privileges to use it for modification.

When you open Netinfo Manager, you can browse a set of items, among which users and groups. When you select a user or a group, you'll see a set of properties and values. Each grup is identified by a gid number, and each user by a uid number - and a gid that refers to its default group.
If you want a user to belong also to other groups (say e.g. to group www), you need to add the name (not the gid) of the user to group www's "users" propertiy. If the "users" property (in groups -> www) does not exist - by default it's not there - , you need to create it by using the "new" icon top left.

If instead you want to do it from command line, take a look here. An example is
dseditgroup -o edit -a username -t user groupname
(you may have to sudo this!)

4 comments:

Uday said...

Apple has removed netinfo in 10.5. I am pretty stuck here for adding new group!

Marco Ronchetti said...

It is now possible by using the dseditgroup command from a terminal.
See man dseditgroup
for details. Also, you could take a look a this page

Ajay Gautam said...

You could add a group through the UI:

System Preferences -> Accounts -> + (Add button) -> New Account (type): Group

Ajay Gautam

bizkutrai said...

thanks Ajay Gautam