How do I remove a user from a group?
You can use gpasswd
:
# gpasswd -d user group
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.
On Debian, the adduser
package contains a deluser
program which removes a user from a group if you pass both as arguments:
deluser user group
If your distribution doesn't have adduser
, you can edit /etc/group
and /etc/gshadow
manually.
vigr
vigr -s
usermod -G "" username
removes all secondary/supplementary groups from username, leaving them as a member of only their primary group. this worked in Solaris 5.9