gpasswd Command in Linux with examples Last Updated : 11 Apr, 2024 Comments Improve Suggest changes Like Article Like Report gpasswd command is used to administer the /etc/group and /etc/gshadow. As every group in Linux has administrators, members, and a password. It is an inherent security problem as more than one person is permitted to know the password. However, groups can perform co-operation between different users. This command assigns a user to a group with some security criteria. This command is called by a group administrator with a group name only which prompts for the new password of the group. System administrators can use the -A option to define group administrator(s) and -M option to define members. They have all the rights of the group administrators and members. Basic Syntax of gpasswd Command:The basic syntax of the gpasswd command is straightforward: gpasswd [option] [group]Here, [options] represent various command-line flags that modify the behavior of the gpasswd command. [group] specifies the name of the group to be modified. Options in gpasswd Command: Here only -A and -M options can be combined. -a, --add : This option is used to add a user to the named group.-d, --delete : It is used to remove a user from the named group.-r, --remove-password : It is used to remove the password from the named group.-R, --restrict : This option will restrict the access to the named group.-A, --administrators : Set the list of administrative users.-M, --members : It set the list of group members.-h, --help : It displays the help message and exit. $ sudo gpasswd -h Examples of gpasswd Command : Creating a group and adding a user to it. After that deleting the user. Adding a group named as geeks. $ sudo groupadd geeksadding group nameTo display the created group with their id you can use: $cat /etc/grouplisting groupsNow the group geeks is added so now execute command under to add the user to group geeks: $ sudo gpasswd -a umang geeksDeleting the created user from group geeks. $ sudo gpasswd -d umang geeksConclusionIn conclusion, the gpasswd command in Linux serves as a crucial tool for managing group passwords and membership, addressing inherent security challenges by enabling administrators to control access effectively. Through its simple syntax and various options like adding or removing users, setting passwords, and designating administrators and members, gpasswd empowers system administrators to enhance security and collaboration within the Linux environment. Comment More infoAdvertise with us U UmangPincha Follow Improve Article Tags : Linux-Unix Similar Reads Finger command in Linux with Examples The 'finger' command is a powerful utility in Linux used to display information about users logged into the system. This command is commonly used by system administrators to retrieve detailed user information, including login name, full name, idle time, login time, and sometimes the user's email add 4 min read fmt command in Linux with examples fmt command in LINUX actually works as a formatter for simplifying and optimizing text files. Formatting of text files can also be done manually, but it can be really time-consuming when it comes to large text files, this is where fmt comes to rescue. fmt re-formats each paragraph in the file specif 4 min read fold command in Linux with examples The fold command in Linux wraps each line in an input file to fit a specified width and prints it to the standard output. By default, it wraps lines at a maximum width of 80 columns, which is configurable. To fold input using the fold command pass a file or standard input to the command. Syntax of ` 3 min read for command in Linux with Examples IntroductionThe for command in linux used in shell scripting to iterate over a set of values or perform set of tasks repeatedly. The for loop allows users to automate operations efficiently which is easier to maintain.Syntax: for NAME [in WORDS ... ] ; do COMMANDS; doneHere NAME takes the value of e 2 min read free Command in Linux with examples While using LINUX there might come a situation when you are willing to install a new application (big in size) and you wish to know the amount of free memory available on your system. In LINUX, there exists a command line utility for this and that is the 'free' command which displays the total amoun 6 min read Fun Commands in Linux Linux isn't just for coding and administrationâit can also be a lot of fun. With a variety of terminal commands, you can add some entertainment to your Linux experience. Below is a list of some cool and fun commands you can use in Linux to enhance your terminal experience. Weâll also cover how to in 3 min read function command in Linux with examples The function is a command in Linux that is used to create functions or methods. It is used to perform a specific task or a set of instructions. It allows users to create shortcuts for lengthy tasks making the command-line experience more efficient and convenient. The function can be created in the u 2 min read Compiling with g++ g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file. The different "options" of g++ command allow us to stop this process at the intermediate stage.  Check g++ compiler version informa 3 min read gawk command in Linux with Examples The gawk command in Linux is a pattern scanning and processing language. No compilation is required, and variables can be used along with numeric functions, string functions, and logical operators. Gawk is a utility that enables programmers to write highly compact but still effective programs as sta 3 min read gcc command in Linux with examples GCC stands for GNU Compiler Collections which is used to compile mainly C and C++ language. It can also be used to compile Objective C and Objective C++. The most important option required while compiling a source code file is the name of the source program, rest every argument is optional like a wa 2 min read Like