← 返回命令列表

Linux command

groupmems 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Add user to group

sudo groupmems -g [group] -a [user]

Remove user from group

sudo groupmems -g [group] -d [user]

List group members

sudo groupmems -g [group] -l

Purge all members

sudo groupmems -g [group] -p

说明

groupmems manages group membership. It allows administrators to add or remove users from groups without directly editing /etc/group. The tool provides a safe interface for group membership changes. Regular users can manage their own primary group without superuser privileges; only the superuser can modify other groups using the -g option.

参数

-g, --group _GROUP_
Target group name. Required for superuser; regular users operate on their primary group.
-a, --add _USER_
Add user to group.
-d, --delete _USER_
Delete user from group.
-l, --list
List group members.
-p, --purge
Purge all members from the group.
-R, --root _DIR_
Apply changes in the specified chroot directory.
-h, --help
Display help information.

FAQ

What is the groupmems command used for?

groupmems manages group membership. It allows administrators to add or remove users from groups without directly editing /etc/group. The tool provides a safe interface for group membership changes. Regular users can manage their own primary group without superuser privileges; only the superuser can modify other groups using the -g option.

How do I run a basic groupmems example?

Run `sudo groupmems -g [group] -a [user]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -g, --group _GROUP_ do in groupmems?

Target group name. Required for superuser; regular users operate on their primary group.