GROUPADD(8)
๐ GROUPADD(8) โ System Management Commands ๐
okay bestie, gather round, because we're talking about groupadd from the groupadd(8) manual page โ the Shadow utils baddie that makes brand new group accounts and honestly? she's iconic. โจ
๐ธ NAME ๐ธ
groupadd โ create a new group ๐
๐ฆ SYNOPSIS ๐ฆ
groupadd [OPTIONS] NEWGROUP
๐ DESCRIPTION ๐
so basically, groupadd makes a whole new group account. it takes the values you typed on the command line, mixes them with the default values chillin' in your system, and boom โ new group. the new group gets entered into the system files as needed, no cap. ๐ซถ
now, groupname rules, and you WILL respect them:
- only lower and upper case letters, digits, underscores, dashes, or dots. that's it.
- they can end with a dollar sign ๐ธ
- dashes are NOT allowed at the beginning of the groupname (front-row seats are taken, sorry)
- fully numeric groupnames? no. groupnames that are just
.or..? absolutely not. - and groupnames may only be up to 32 characters long. that's the ceiling, bestie.
โจ OPTIONS โจ
the options that apply to groupadd are giving main character energy:
-f,--forceโ makes the command just... exit with success status if the group you asked for already exists. chill behavior honestly. when it's used with-gand the GID you named already exists, a different (unique) GID gets chosen instead โ i.e.-ggets turned off. ๐ซ-g,--gid GIDโ the numerical value of the group's ID. this GID must be unique unless you're using the-ooption. the value has to be non-negative. by default it uses the smallest ID value greater than or equal toGID_MINand greater than every other group. ๐
also peep the -r option and the GID_MAX description, iykyk.
-h,--helpโ displays the help message and dips out. ๐-K,--key KEY=VALUEโ overrides the/etc/login.defsdefaults (GID_MIN,GID_MAXand others, she's flexible). you can stack multiple-Koptions, no problem.
example: -K GID_MIN=100 -K GID_MAX=499
note: -K GID_MIN=10,GID_MAX=499 doesn't work yet. ๐ญ don't try it, it's not ready.
-o,--non-uniqueโ permits creating a group with an already used numerical ID. as a result, for this GID, the mapping towards groupNEWGROUPmay not be unique. so like, sharing is allowed, but the vibes get a lil chaotic. ๐-p,--password PASSWORDโ defines an initial password for the group account.PASSWORDis expected to be encrypted, as returned bycrypt(3).
without this option, the group account will be locked and with no password defined, i.e. a single exclamation mark in the respective field of the system account file /etc/group or /etc/gshadow.
note: this option is not recommended because the password (or encrypted password) will be visible by users listing the processes. literally everyone can see it bestie, please.
you should make sure the password respects the system's password policy.
-r,--systemโ creates a system group. ๐
the numeric identifiers of new system groups are chosen in the SYS_GID_MIN-SYS_GID_MAX range, defined in login.defs, instead of GID_MIN-GID_MAX.
-R,--root CHROOT_DIRโ applies changes in theCHROOT_DIRdirectory and uses the configuration files from theCHROOT_DIRdirectory. only absolute paths are supported. no SELINUX support. ๐ช-P,--prefix PREFIX_DIRโ applies changes to configuration files under the root filesystem found under the directoryPREFIX_DIR. this option does not chroot and is intended for preparing a cross-compilation target. some limitations, heads up: NIS and LDAP users/groups are not verified. PAM authentication is using the host files. no SELINUX support.-U,--usersโ a comma-separated list of usernames to add as members of the group. ๐ซถ
the default behavior (if the -g, -N, and -U options are not specified) is defined by the USERGROUPS_ENAB variable in /etc/login.defs.
๐ CONFIGURATION ๐
these configuration variables in /etc/login.defs change how this tool behaves, so listen up:
GID_MAX(number),GID_MIN(number) โ range of group IDs used for the creation of regular groups byuseradd,groupadd, ornewusers.
the default value for GID_MIN (resp. GID_MAX) is 1000 (resp. 60000).
MAX_MEMBERS_PER_GROUP(number) โ maximum members per group entry. when the maximum is reached, a new group entry (line) is started in/etc/group(with the same name, same password, and same GID).
the default value is 0, meaning there are no limits in the number of members in a group.
this feature (split group) permits limiting the length of lines in the group file. this is useful to make sure that lines for NIS groups are not larger than 1024 characters.
if you need to enforce such a limit, you can use 25.
note: split groups may not be supported by all tools (even in the Shadow toolsuite). you should not use this variable unless you really need it. fr fr.
SYS_GID_MAX(number),SYS_GID_MIN(number) โ range of group IDs used for the creation of system groups byuseradd,groupadd, ornewusers.
the default value for SYS_GID_MIN (resp. SYS_GID_MAX) is 101 (resp. GID_MIN-1).
๐ FILES ๐
/etc/groupโ group account information. ๐๏ธ/etc/gshadowโ secure group account information. ๐/etc/login.defsโ shadow password suite configuration. โ๏ธ
๐ญ CAVEATS ๐ญ
- you may not add a NIS or LDAP group. this must be performed on the corresponding server. not your job, not your problem, go ask the server. ๐
- if the groupname already exists in an external group database such as NIS or LDAP,
groupaddwill deny the group creation request. she said no. ๐ซ
๐ EXIT VALUES ๐
groupadd exits with these values, so you know exactly what happened:
0โ success ๐2โ invalid command syntax3โ invalid argument to option4โ GID is already used (when called without-o)9โ group name is already used10โ can't update group file
๐ SEE ALSO ๐
chfn(1), chsh(1), passwd(1), gpasswd(8), groupdel(8), groupmod(8), login.defs(5), useradd(8), userdel(8), usermod(8).
and that's the whole page bestie!! this one's from shadow-utils 4.20.0, dated 07/30/2026 โ go forth and make groups, you absolute icon ๐๐โจ
๐ฆ where this page comes from
- arch rolling: shadow 4.20.0.arch1-1 ยท 0BSD AND BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms