Which command should I use to remove a user from a group in Debian?
When adding a user to a group, it can be done with:
usermod -a -G group user
However, I could not find a similar command (accepting a group and user as arguments) for removing the user from the group. The closest I could get is:
usermod -G all,existing,groups,except,for,group user
Is there a command like usermod OPTION group user
with OPTION an option to make usermod
(or a similar program) remove the user from group?
Best Answer
You can use
gpasswd
:then the new group config will be assigned at the next login, at least on Debian. If the user is logged in, the effects of the command aren't seen immediately.