Remove Linux User From a Secondary Group ( Supplementary Groups )

https:/‮ual.www/‬tturi.com
Remove Linux User From a Secondary Group ( Supplementary Groups )

To remove a user from a secondary group (also known as a supplementary group) on a Linux system, you can use the "gpasswd" command with the "--delete" option.

For example, to remove the user "john" from the group "developers", you can use the following command:

sudo gpasswd --delete john developers

This will remove the user "john" from the group "developers", but it will not affect the user's primary group or any other supplementary groups that the user belongs to.

If you want to remove a user from all supplementary groups, you can use the "usermod" command with the "--groups" option and specify an empty group list. For example:

sudo usermod --groups "" john

This will remove the user "john" from all supplementary groups and leave the user's primary group unchanged.

Keep in mind that these changes will not take effect until the user logs out and logs back in again, or until the user's session is otherwise terminated and re-initialized.

Created Time:2017-10-30 14:27:16  Author:lautturi