博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux groupmems命令
阅读量:6535 次
发布时间:2019-06-24

本文共 1724 字,大约阅读时间需要 5 分钟。

Because users group membership is defined in two different locations, it can be difficult to find out which groups exactly a user is a member of. A convenient command to check this is  groupmems . Use, for example, the command  groupmems -g sales -l  to see which users are a member of the group sales. This shows users who are a member of this group as a secondary group assignment, but also users who are a member of this group as the primary group assignment. 

[root@rhel7 ~]# groupmems --helpUsage: groupmems [options] [action]Options:  -g, --group groupname         change groupname instead of the user's group                                (root only)  -R, --root CHROOT_DIR         directory to chroot intoActions:  -a, --add username            add username to the members of the group  -d, --delete username         remove username from the members of the group  -h, --help                    display this help message and exit  -p, --purge                   purge all members from the group  -l, --list                    list the members of the group

例:

查看有哪些用户属于sales组

[root@rhel7 ~]# groupmems -g sales -llinda lisa

从sales组中删除lisa

[root@rhel7 ~]# groupmems -d lisa -g sales  [root@rhel7 ~]# groupmems -g sales -llinda

添加用户到组里

[root@rhel7 ~]# id lxj2uid=1002(lxj2) gid=0(root) groups=0(root)[root@rhel7 ~]# groupmems -a lxj2 -g sales[root@rhel7 ~]# id lxj2uid=1002(lxj2) gid=0(root) groups=0(root),1238(sales)

也可以使用usermod命令将用户添加到组里 

usermod -aG  will add users to new groups that will be used as their secondary group.

Use  usermod  to add users linda and lisa to the group sales, and lori and bob to the group account:    

usermod -aG sales linda  usermod -aG sales lisa  usermod -aG account lori  usermod -aG account bob

 

转载地址:http://sjzdo.baihongyu.com/

你可能感兴趣的文章
设计时(Design-Time)
查看>>
【Android】Parse 开发笔记(4)—— Push Notifications(上)
查看>>
利用CSS3制作淡入淡出动画效果
查看>>
mysql存储过程之游标遍历数据表
查看>>
HTTP 状态代码
查看>>
div文字超出
查看>>
oracle存储过程异常捕获
查看>>
how to use perf
查看>>
HDU 1079 Calendar Game(简单博弈)
查看>>
【deep learning学习笔记】注释yusugomori的DA代码 --- dA.h
查看>>
Ubuntu 12.04 root用户登录设置
查看>>
windows核心编程-互斥器(Mutexes)
查看>>
java5 CyclicBarrier同步工具
查看>>
纯手工打造漂亮的垂直时间轴,使用最简单的HTML+CSS+JQUERY完成100个版本更新记录的华丽转身!...
查看>>
CodeForces 27D - Ring Road 2 构图2-sat..并输出选择方案
查看>>
java 为啥变量名前要加个m?
查看>>
对依赖倒置原则(DIP)及Ioc、DI、Ioc容器的一些理解
查看>>
探索Android中的Parcel机制(上)
查看>>
端口映射工具--socat
查看>>
前端架构一之XAMPP
查看>>