Forrest logo
back to the gpasswd tool

gpasswd:tldr:8e488

gpasswd: Add a user to the named group.
$ gpasswd -a ${user} ${group}
try on your machine

The command "gpasswd -a ${user} ${group}" is used to add a user to a specific group using the gpasswd command in Linux or Unix-based operating systems.

Here's what each part of the command means:

  • gpasswd: It is a command-line utility used to administer the /etc/group file and group passwords.
  • -a: It is an option that stands for "add." It is used to add a user to a group.
  • ${user}: It is a placeholder representing the username of the user you want to add to a group. You should replace ${user} with the actual username.
  • ${group}: It is a placeholder representing the group name you want to add the user to. You should replace ${group} with the actual group name.

For example, if you want to add the user "john" to the group "developers," you would run the command: gpasswd -a john developers. This will add the user "john" to the "developers" group.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the gpasswd tool