User group management in Linux

Time:2021-7-28

User group Description:

  • Group is one of the user‘s attribute information;
  • Any user has only one default group;
  • A user can have multiple additional groups;
  • There is no relationship between the default group and the additional group;
#Create group
groupadd admin

#View group information
tail /etc/group
#Add test3 user to admin additional group
usermod -G admin test3
id test3

#Modify the default group of test3 users to sys group
usermod -g sys test3
#To delete a group, you can also delete members in the additional group. By default, members in the group cannot be deleted
groupdel admin
#Join Yunwei user to admin additional group
gpasswd -a yunwei admin

#Set the members of the admin additional group, and the original members will be overwritten
gpasswd -M test1,test2,test3 admin

#Remove a member from the admin attachment group
gpasswd -d test1 admin
#Set test2 as the administrator of the admin additional group to manage the group members
gpasswd -A test2 admin

#View group details, including administrators, members, and so on
tail /etc/gshadow

Recommended Today

Supervisor

Supervisor [note] Supervisor – H view supervisor command help Supervisorctl – H view supervisorctl command help Supervisorctl help view the action command of supervisorctl Supervisorctl help any action to view the use of this action 1. Introduction Supervisor is a process control system. Generally speaking, it can monitor your process. If the process exits abnormally, […]