New users and students learning how to use Linux should start on Ubuntu Linux OS… Ubuntu is an open source Linux operating systems that runs on desktops, laptops, server and other devices…
The same way one uses a mouse or keyboard to make changes to his/her computer or perform others simple tasks on Microsoft Windows OS, Ubuntu also makes it that easy… If you think Microsoft Windows is easy, then Ubuntu may be great for you and great for beginners also…
However, when you’re learning to use and understand Ubuntu Linux, you’ll also want to learn the comnands behind the graphics and mouse-clicking… and how to use them… This tutorial is going to show you how…..
This post shows new users and students what the gpasswd command is used for and how to use it…
When you’re ready to learn how to use the gpasswd commands, follow the guide below:
About gpasswd command:
The gpasswd command is used to administer /etc/group and /etc/gshadow files….. Like using your mouse and keyboard to manage users and groups, the gpasswd is the way to do it on the command line… The /etc/group file contains groups information and the /etc/gshadow file contains encrypt groups into…
The following configuration variables in /etc/login.defs change the behavior of gpasswd … Edit that file to configure other settings…
The syntax is the rule and format of how the gpasswd command can be used… the systax can options can be reordered.. but straight format must be followed.,.
Below is an example syntax of how to use the gpasswd comamnd….
gpasswd [OPTION]... GROUP...
The command line options are switches or flags that determined how the commands are executed or controlled… they modify the behavior of the command… they are separated by spaces and followed after the commands options…
Below are some options of the gpasswd command:
|GROUP…||Replace GROUP….. with the name of the account you want to manage…….|
|-a, –add USER
||Use the -a or –add USER option to add a to a GROUP… Replace USER with the user account you wish to add to the group|
|-d, –delete USER||Use the -d or –delete USER option to remove a user from a GROUP….. Replace USER with the user you wish to remove…|
|-R, –restrict||Use the -R or –restrict option to restrictaccess to GROUP to its members|
|-M, –members USER||Use the -M or –members USER to set the list of members of GROUP|
|-A, –administrators ADMIN||set the list of administrators for GROUP.. ADMIN with the name or the user account…|
Below are some examples of how to run and use the gpasswd on Ubuntu Linux…
If you want to add a user name John to the group called Players, run the commands below……
gpasswd -a john players
To give John adminstrative rights to manage the Players group, run the commands…..
gpasswd -A john players
The commands above make John an admin of the players group….
If you’re not logged in as a root account, you may have to use the sudo command it it…
sudo gpasswd -A john players
To remove John’s account from the group, run the commands below…
sudo gpasswd -d john players
When you run gpasswd with the –help option, you’ll see the help text below:
Usage: gpasswd [option] GROUP Options: -a, --add USER add USER to GROUP -d, --delete USER remove USER from GROUP -h, --help display this help message and exit -Q, --root CHROOT_DIR directory to chroot into -r, --remove-password remove the GROUP's password -R, --restrict restrict access to GROUP to its members -M, --members USER,... set the list of members of GROUP -A, --administrators ADMIN,... set the list of administrators for GROUP Except for the -A and -M options, the options cannot be combined.
Hope you like it and please come back soon for more Ubuntu Linux command!
You may also like the commands below: