GPASSWD(1)

โœจ GPASSWD โœจ (that's section 1 of the manual bestie, user commands ๐Ÿ’…)

okay so real talk: gpasswd is the girl who runs the group chat. not like, your group chat โ€” the actual groups on your system. she's out here administering /etc/group and /etc/gshadow and she takes her job very seriously ๐Ÿซถ


๐ŸŒธ NAME ๐ŸŒธ

gpasswd โ€” administer /etc/group and /etc/gshadow


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

gpasswd [option] group

๐Ÿ’– DESCRIPTION ๐Ÿ’–

The gpasswd command is used to administer /etc/group and /etc/gshadow. Every single group can have administrators, members and a password. like, every group is a little friend group with a group chat password, no cap ๐Ÿ”

System administrators can use the -A option to define group administrator(s) and the -M option to define members. And bestie, they have all the rights of group administrators and members. main character energy fr ๐Ÿ‘‘

When gpasswd is called by a group administrator with a group name only, it prompts for the new password of the group. just the group name, nothing else, and it's gonna ask you for the password.

If a password is set, the members can still use newgrp(1) without a password, and non-members must supply the password. so the members get the VIP skip-the-line pass and everyone else has to say the magic word โœจ

๐Ÿ”’ Notes about group passwords ๐Ÿ”’

Group passwords are an inherent security problem, since more than one person is permitted to know the password. yeah. that's just... the vibe. it's a shared secret and shared secrets are messy ๐Ÿ’€

However, groups are a useful tool for permitting co-operation between different users. so like, it's a tradeoff, and it's genuinely useful, we're just being honest about the risk here.


๐Ÿ’… OPTIONS ๐Ÿ’…

Except for the -A and -M options, the options cannot be combined. not negotiable, no stacking, pick one and commit ๐Ÿšซ

The options which apply to the gpasswd command are:

  • -a, --add user โ€” Add the user to the named group. welcome to the group chat bestie ๐ŸŽ‰
  • -d, --delete user โ€” Remove the user from the named group. it's giving exit interview ๐Ÿ˜ญ
  • -h, --help โ€” Display help message and exit.
  • -Q, --root CHROOT_DIR โ€” Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory. Only absolute paths are supported. No SELINUX support. (absolute paths only, and SELINUX is not invited to this party)
  • -r, --remove-password โ€” Remove the password from the named group. The group password will be empty. Only group members will be allowed to use newgrp to join the named group.
  • -R, --restrict โ€” Restrict the access to the named group. The group password is set to "!". Only group members with a password will be allowed to use newgrp to join the named group.
  • -A, --administrators user,... โ€” Set the list of administrative users.
  • -M, --members user,... โ€” Set the list of group members.

โš ๏ธ CAVEATS โš ๏ธ

This tool only operates on the /etc/group and /etc/gshadow files. Thus you cannot change any NIS or LDAP group. That must be performed on the corresponding server. so if you're sitting there wondering why your LDAP group is not budging โ€” she literally cannot see it, she's local-only, periodt ๐Ÿšซ๐ŸŒ


๐ŸŒˆ CONFIGURATION ๐ŸŒˆ

The following configuration variables in /etc/login.defs change the behavior of this tool:

ENCRYPT_METHOD (string)

This defines the system default encryption algorithm for encrypting passwords (if no algorithm is specified on the command line).

It can take one of these values: SHA256, SHA512 (default), YESCRYPT. See crypt(5) for recommendations.

Note: this only affects the generation of group passwords. The generation of user passwords is done by PAM and subject to the PAM configuration. It is recommended to set this variable consistently with the PAM configuration.

History: This variable is used by other programs, which may still default to unsafe algorithms such as DES. To avoid using unsafe algorithms, the variable should always be specified. like please specify it, do not leave it on read ๐Ÿ™

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 that there are no limits in the number of members in a group.

This feature (split group) permits to limit 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 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.

SHA_CRYPT_MIN_ROUNDS (number), SHA_CRYPT_MAX_ROUNDS (number)

When ENCRYPT_METHOD is set to SHA256 or SHA512, this defines the number of SHA rounds used by the encryption algorithm by default (when the number of rounds is not specified on the command line).

With a lot of rounds, it is more difficult to brute force the password. But note also that more CPU resources will be needed to authenticate users. more rounds = more secure = more CPU = your machine is sweating ๐Ÿ’€

If not specified, the libc will choose the default number of rounds (5000), which is orders of magnitude too low for modern hardware.

The values must be inside the 1000-999,999,999 range.

If only one of the SHA_CRYPT_MIN_ROUNDS or SHA_CRYPT_MAX_ROUNDS values is set, then this value will be used.

If SHA_CRYPT_MIN_ROUNDS > SHA_CRYPT_MAX_ROUNDS, the highest value will be used.

Note: this only affect the generation of group passwords. The generation of user passwords is done by PAM and subject to the PAM configuration. It is recommended to set this variable consistently with the PAM configuration.

๐Ÿ—‚๏ธ FILES ๐Ÿ—‚๏ธ

  • /etc/group โ€” Group account information.
  • /etc/gshadow โ€” Secure group account information.

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

newgrp(1), groupadd(8), groupdel(8), groupmod(8), grpck(8), group(5), gshadow(5).


and that's the whole page bestie, you ate that ๐Ÿ“

this lil masterpiece is from shadow-utils 4.20.0, dated 07/30/2026 โ€” go forth and administer your groups responsibly, ily, mwah ๐Ÿ’‹๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from