Which of the following commands can remove a user from a group?
Which of the following commands can remove a user from a group?
The 'usermod' command can be used to modify a user's group memberships. Specifically, the '-G' option can change the groups a user belongs to, and therefore can remove a user from a particular group by specifying a new list of groups that does not include the group to be removed. This makes 'usermod' the correct answer for the command that can remove a user from a group.
generally admins mostly use gpasswd command for this. like: gpasswd --delete user group However, usermod -G "" username removes all secondary/supplementary groups from username, leaving them as a member of only their primary group. Thus usermod can be indirectly used to achieve this question purpose.