Take the 2-minute tour ×
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.

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
sftponly
#gpasswd -d userA sftponly
Removing user userA from group sftponly
gpasswd: unknown member userA

#tail /etc/group
userA:x:509:
sftponly:x:510:
#tail /etc/passwd
userA:x:509:510::/home/userA:/bin/bash/

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

3 Answers 3

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
sftponly

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

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

gpasswd -d user group

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.