Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

Asked and answered many times, but I can't get it working!!!

(On CentOS) I have the user userA and I want to remove it from group sftponly.

#groups userA
userA : sftponly
#id -Gn userA
#gpasswd -d userA sftponly
Removing user userA from group sftponly
gpasswd: unknown member userA

#tail /etc/group
#tail /etc/passwd

so gpasswd not working. Also:

usermod -G fourpoints fourpoints 

No result.

I don't know really what to do, I'm not sure about editing /etc/group either...

share|improve this question

Ran into the same issue. Was able to do the following to resolve this:

gpasswd -d user group

share|improve this answer
No idea why this answer has not been upvoted. It's best practice! – val0x00ff May 21 '15 at 20:25

You cannot remove this user from that group given it's the only group that they're a member of. This is evident in the output being returned to you by the groups userA command:

$ groups userA
userA : sftponly

Also the id output:

$ id -Gn userA

Look in the /etc/passwd file for this user, this is most probably their primary group. You'll have to either move them to another group (by changing their primary in /etc/passwd) or delete their account entirely.

share|improve this answer

I think it's necessary first to change the main group to the userA:

#usermod -g userA userA

and then the user can be removed from the group with gpasswd

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.