Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I remove a user from a group from the command line in OpenSolaris (2008.11)?

I know I can define a user's primary group and a add a user to a group with:

usermod -g primarygroup user
usermod -G group_list user

What's the corresponding command to undo that action and remove a user from the group without just editing /etc/groups

share|improve this question

migrated from Nov 6 '10 at 16:28

This question came from our site for professional and enthusiast programmers.

You could try something like this: usermod -G "" username

That should remove them from the extra group. This appears to work in SOL10/OSOL/Linux. It's worth noting that'll remove them from ALL extra groups. If you want to just remove them from one just get their current groups list: id username

Then just build the list of extra groups to add with usermod -G and don't add the one you want to take them out of.

share|improve this answer

The following answer applies to Debian, but maybe it will work on OpenSolaris as well.

Run usermod -g another_group user (modifies /etc/passwd), and/or run usermod -G group_list user (modifies /etc/group).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.