Gpasswd command
Function: Manage groups
Usage: gpasswd [-a user] [-D user] [-a user,...] [-M User,...] [-R] [-R] groupname
Parameters:
-A: Add a user to a group
-D: delete a user from a group.
-A: Specifies the administrator.
-M: the specified group member is similar to-.
-R: Delete the password.
-R: restrict user logon to the group. Only members in the group can use newgrp to join the group.
Gpasswd groupname: if the system has a Peter account, the account itself is not a member of the groupname group. To use newgrp, enter a password.
Allow the user to temporarily join the group. Then, the file group created by Peter will also be groupname. Therefore, this method allows Peter to set up
Use other groups, rather than the group where Peter is.
Therefore, you can use gpasswd groupname to set the password so that those who know the group password can temporarily switch to those who have the groupname group function.
Gpasswd-a Peter users
In this way, Peter is the administrator of the users group and can perform the following operations:
Gpasswd-a Mary users
Gpasswd-A Allen users
Note: to add a user to a group, you can use the usermod-G group_name user_name command to add a user to the specified group, but the previously added group will be cleared.
Therefore, to add a user to a group and retain the previously added group, use the gpasswd command to add the user:
Gpasswd-A user_name group_name
When you design a website, Multiple Programming devices are used together to design and modify the website, at this time, we need to set the resource tray to have a designated person who has administrative rights. In Windows, we can use the resource tray security for control, similar functions are also available in Linux. Towns heard the upg (User private group) function in the previous step. Next we will explain it with instructions.
The upg (User private group) function is easy to manage. You only need to use a single command to complete the operation. The following describes how to use the command.
Gpasswd <group> <= create a secret for a specific group
Gpasswd-A <user> <group> <= Add a user to a specific group
Gpasswd-A <user> <group> <= Add a manager to a specific group
Gpasswd-D <user> <group> <= exclude users in a specific group
Gpasswd-r <group> <= remove group secret
Gpasswd-r <group> <= add to group secret (used with gpasswd <group> secret)
Gshadow Structure
Group name secret: group secret: appointed Administrator: group members
Group Structure
Group name secret: group representative: group members
Newgrp
Example
Today, we have a new case where we want to design an Iot platform. We have three programming languages (towns01, towns02, and towns03) to write our program together, towns requires an open space to provide three programmers to enter the space at the same time, with some management rights. Towns creates an item and group, and sets towns as the Group Administrator.
Mkdir/logs
Groupadd rule
Gpasswd-A towns restart
Usermod command
Usermod-a-g root towns ==> Add towns to the root group so that towns queues have root privileges
This command can also be executed to the result of gpasswd-A <user> <group>.
Http://itgroup.blueshop.com.tw/towns/hc? N = convew & I = 192024