← 返回命令列表

Linux command

addgroup 命令

安全

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

常用示例

Create

sudo addgroup [groupname]

Example

sudo addgroup --system [groupname]

Example

sudo addgroup [username] [groupname]

Example

sudo addgroup --gid [1001] [groupname]

说明

addgroup is a Debian/Ubuntu friendly frontend to the low-level groupadd command. It creates new groups or adds existing users to groups, following the naming policies and conventions defined in adduser.conf. When adding a user to a group, it modifies /etc/group to include the user as a member. This is the recommended way to manage group membership on Debian-based systems.

参数

--gid _id_
Specify the group ID (GID) for the new group
--system
Create a system group (GID from system range)
--allow-bad-names
Allow group names that don't conform to naming conventions
--conf _file_
Use alternate configuration file
--quiet
Suppress informational messages
--debug
Print debug information

FAQ

What is the addgroup command used for?

addgroup is a Debian/Ubuntu friendly frontend to the low-level groupadd command. It creates new groups or adds existing users to groups, following the naming policies and conventions defined in adduser.conf. When adding a user to a group, it modifies /etc/group to include the user as a member. This is the recommended way to manage group membership on Debian-based systems.

How do I run a basic addgroup example?

Run `sudo addgroup [groupname]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --gid _id_ do in addgroup?

Specify the group ID (GID) for the new group