gpasswd: command not found

gpasswd is a command-line utility in Linux and Unix-like systems that allows administrators to administer the /etc/group and /etc/gshadow files. These files contain information about the groups on the system, including the group name, the group ID, and the list of users that are members of the group.

The gpasswd command can be used to perform a variety of tasks related to group management, such as:

  • Adding and removing users from a group
  • Changing the group’s name or ID
  • Changing the group’s password (if the /etc/gshadow file is used)
  • Displaying information about a group

If you encounter the below error while running the command gpasswd:

gpasswd: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install passwd
Ubuntu apt-get install passwd
Alpine apk add shadow
Arch Linux pacman -S shadow
Kali Linux apt-get install passwd
Fedora dnf install shadow-utils-2
Raspbian apt-get install passwd

gpasswd Command Examples

1. Define group administrators:

# sudo gpasswd -A user1,user2 group

2. Set the list of group members:

# sudo gpasswd -M user1,user2 group

3. Create a password for the named group:

# gpasswd group

4. Add a user to the named group:

# gpasswd -a user group

5. Remove a user from the named group:

# gpasswd -d user group
Related Post