Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

How to add a user to a UNIX group UNIX
In Unix, you can easily add a user to a group by editing the /etc/group file. In the NetInfo days, there were equivalent methods in Mac OS X. Now that NetInfo has been replaced, how do you add a user as a member of a group? Here's how you can do it in Snow Leopard.

First, to find which groups you are currently in, you can use: % groups which promptly listed all the groups, except the one I needed. How do you add the user?

That's where the dseditgroup command comes in. It's a command-line tool which can perform certain editing operations on groups. It has an explanatory man page, and I used this command to add a username to a group. The parameter -u yourusername is your admin account, and the -p will prompt for the password.

% dseditgroup -o edit -u yourusername -p -a username -t user group.

[crarko adds: I tested this, and it works as described. You can consult the man page for dseditgroup for more information.]
    •    
  • Currently 2.83 / 5
  You rated: 4 / 5 (12 votes cast)
 
[32,307 views]  

How to add a user to a UNIX group | 6 comments | Create New Account
Click here to return to the 'How to add a user to a UNIX group' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
How to add a user to a UNIX group
Authored by: sys0p on Jun 10, '10 07:56:06AM

or one uses the System Preferences > Accounts > + > Change "New Account" to "Group" and add the Users via the GUI :)



[ Reply to This | # ]
How to add a user to a UNIX group
Authored by: bcamp1973 on Jun 10, '10 08:18:12AM

That only applies to *new* groups you create though correct?



[ Reply to This | # ]
How to add a user to a UNIX group
Authored by: barefootguru on Jun 10, '10 09:32:06AM

Once you've created a group through System Prefs you can edit membership through there too.



[ Reply to This | # ]
How to add a user to a UNIX group
Authored by: llee on Jun 10, '10 07:56:11AM

You can do lots of stuff like this in a GUI if you install Server Admin Tools and point Workgroup Manager to your standalone Mac (127.0.0.1).



[ Reply to This | # ]
How to add a user to a UNIX group
Authored by: crarko on Jun 10, '10 08:00:51AM

A lot of network admins make extensive use of the command line tools. Especially since they can be used in batch mode.



[ Reply to This | # ]
How to add a user to a UNIX group
Authored by: tom larkin on Jun 10, '10 02:52:30PM

you can also do it via dscl. see example:

dscl . append /Groups/foo GroupMembership username

Swap out foo with the group you want to add membership to, and username with the actual username of the user.

Edited on Jun 10, '10 02:53:21PM by tom larkin


[ Reply to This | # ]