linux系统的一大块就是用户管理,管理用户的信息,这里介绍用户组。 
常用命令有groupadd , groupdel , gpasswd , groups , finger等。
linux用户组分为两类: 
私有组->在创建一个新用户时,若没有指定所属于的组,linux将建立一个和用户同名的私有组 
标准组->可以容纳多个用户,若使用标准组创建一个新用户是应该指定该用户的所在组
【基本操作】 
添加用户组:可以用groupadd,也可以useradd 
 
[root@bogon srv]# groupadd --help  
Usage: groupadd [options] GROUP  
  
Options:  
  -f, --force                   exit successfully if the group already exists,  
                                and cancel -g if the GID is already used  
  -g, --gid GID                 use GID for the new group  
  -h, --help                    display this help message and exit  
  -K, --key KEY=VALUE           override /etc/login.defs defaults  
  -o, --non-unique              allow to create groups with duplicate  
                                (non-unique) GID  
  -p, --password PASSWORD       use this encrypted password for the new group  
  -r, --system                  create a system account 
[root@bogon srv]# grep test /etc/group  
[root@bogon srv]# groupadd test   
[root@bogon srv]# grep test /etc/group  
test:x:508: 
useradd -g 组名 用户名 ----创建用户并将该用户加入到组中
修改用户组:
 
添加删除用户组: 
 
[root@bogon srv]#  gpasswd --help  
gpasswd: unrecognized option '--help'  
Usage: gpasswd [option] GROUP  
Options:  
  -a, --add USER                add USER to GROUP  
  -d, --delete USER             remove USER from GROUP  
  -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.  
[root@bogon srv]# gpasswd -a spark ttest  
Adding user spark to group ttest  
[root@bogon srv]# grep ttest /etc/group  
ttest:x:508:spark 
[root@bogon srv]# grep ttest /etc/group  
ttest:x:508:spark  
[root@bogon srv]# gpasswd -d spark ttest  
Removing user spark from group ttest  
[root@bogon srv]# grep ttest /etc/group  
ttest:x:508: 
groupdel 用户组名 ----删除用户组,该帐号必须存在且不能作为某个用户的私有组引用(不能删除私有组和不存在的组),如果该组中还有其他用户在使用,必须先删除组中的用户才能删除该组
查看用户组:
 
groups 用户名 ----查看用户属于哪个组: 
 
以上就是linux用户组的管理方法,希望对大家有所帮助。