LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gpasswd

Administer group passwords and membership

TLDR

Set a group password interactively
$ gpasswd [group]
copy
Add a user to a group
$ sudo gpasswd --add [user] [group]
copy
Remove a user from a group
$ sudo gpasswd --delete [user] [group]
copy
Replace the member list outright
$ sudo gpasswd --members [user1,user2] [group]
copy
Name the group's administrators
$ sudo gpasswd --administrators [user1,user2] [group]
copy
Clear the group password, so only members can join with `newgrp`
$ sudo gpasswd --remove-password [group]
copy
Restrict the group to its listed members
$ sudo gpasswd --restrict [group]
copy

SYNOPSIS

gpasswd [option] group

DESCRIPTION

gpasswd administers /etc/group and /etc/gshadow files. It is used to add and remove users from groups, set group administrators, and manage group passwords.Group administrators (set with -A) can add or remove members without root privileges, delegating group management to trusted users. Group passwords (rarely used) allow non-members to temporarily join a group using the newgrp command.

PARAMETERS

-a, --add USER

Add user to the group
-d, --delete USER
Remove user from the group
-A, --administrators USER,...
Set list of group administrators
-M, --members USER,...
Set list of group members (replaces existing)
-r, --remove-password
Remove group password
-R, --restrict
Restrict access to group (only members can use newgrp)

INSTALL

sudo apt install passwd
copy
sudo pacman -S shadow
copy
sudo apk add shadow
copy
sudo zypper install shadow
copy
nix profile install nixpkgs#shadow
copy

CAVEATS

The -M option replaces all group members, not appends. Use -a and -d for incremental changes. Group password usage is discouraged in favor of proper membership management. Changes take effect on next login.

HISTORY

gpasswd is part of the shadow-utils package, which provides the shadow password suite for Unix systems. The shadow system was developed in the 1980s to improve password security by moving password hashes from the world-readable /etc/passwd to the restricted /etc/shadow file.

SEE ALSO

groupadd(8), groupmod(8), usermod(8), newgrp(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid