Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to remove user pserver from the group apache.

#deluser pserver apache
/usr/sbin/deluser: You may not remove the user from their primary group.

Now I want to add a new primary group.

#usermod -G pserver pserver

pserver is now in group pserver

#groups pserver
pserver : apache pserver

Now I want to remove the user again from group apache, but I get same error again. How can I delete pserver from the primary group apache?

share|improve this question

1 Answer

up vote 1 down vote accepted

The usermod option -G adds supplementary groups. You want option -g to change the primary group. I.e.:

# usermod -g pserver pserver

This will also change group ownership of files in the home directory, but not elsewhere.

share|improve this answer

Your Answer

 
discard

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.