LinuxCommandLibrary

addgroup

Create new group accounts

SYNOPSIS

addgroup [options] group

PARAMETERS

-g, --gid GID
    Use specified numerical GID for the new group.

-q, --quiet
    Suppress non-error messages.

-r, --system
    Create a system group (low GID, no /etc/gshadow entry).

-O, --non-unique
    Allow non-unique GID (duplicate allowed).

--help
    Display usage information.

--version
    Print version and exit.

DESCRIPTION

The addgroup command is a utility for creating new user groups on Linux systems, primarily used by system administrators to manage access permissions and organize users. It appends a new entry to the /etc/group file and, if shadow groups are enabled, to /etc/gshadow. Groups enable fine-grained control over file and process permissions via setgid bits and supplementary group memberships.

Typically invoked by root or via sudo, addgroup ensures unique group names and IDs unless specified otherwise. It supports creating both regular user groups and system groups (with low GIDs, usually under 1000). Unlike manual editing of config files, it handles consistency, locks files during updates, and respects system policies from /etc/login.defs.

This command is essential for multi-user environments, scripting user setups, and containerization where isolated group namespaces are needed. On Debian-based systems, it's part of the passwd package; equivalents exist in other distros as groupadd.

CAVEATS

Requires root privileges; fails if group exists or GID in use (unless --non-unique); respects /etc/login.defs; may interact with LDAP/NIS if configured.

EXAMPLES

addgroup mygroup
addgroup --system --gid 999 syslog
sudo addgroup --quiet developers

HISTORY

Part of the shadow-utils suite, originally developed by Julianne Frances Haugh in the 1990s to replace /etc/passwd with secure shadow files. Evolved with Linux standards; Debian-specific addgroup wrapper added for user-friendly options.

SEE ALSO

groupadd(8), groupdel(8), groupmod(8), groups(1), id(1)

Copied to clipboard