• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

gpasswd Command Examples in Linux

by Deepika

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

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

Filed Under: Linux

Some more articles you might also be interested in …

  1. Linux Network File System (NFS) interview questions
  2. berks Command Examples (Chef cookbook dependency manager)
  3. mitmdump Command Examples
  4. clamdscan: A command-line virus scanner using the ClamAV Daemon
  5. createrepo: command not found
  6. llvm-config Command Examples
  7. strace: command not found
  8. How to use command redirection under Linux
  9. run-mailcap: command not found
  10. CentOS / RHEL 5 : How to install and configure vsftpd server

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright