You can remove a user from a group using the gpasswd command or the deluser command (on some systems). Here’s how to do it with both methods:
- Using
gpasswd:
sudo gpasswd -d username groupname
Replace username with the actual username and groupname with the name of the group you want to remove the user from.
- Using
deluser(Debian-based systems):
sudo deluser username groupname
Again, replace username with the actual username and groupname with the name of the group.
For example, to remove a user named john from a group named developers, you would run:
sudo gpasswd -d john developers
or
sudo deluser john developers
