linux groupmems命令
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 --help
Usage: groupmems [options] [action] Options:
-g, --group groupname change groupname instead of the user's group
(root only)
-R, --root CHROOT_DIR directory to chroot into Actions:
-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 -l
linda lisa
从sales组中删除lisa
[root@rhel7 ~]# groupmems -d lisa -g sales
[root@rhel7 ~]# groupmems -g sales -l
linda
添加用户到组里
[root@rhel7 ~]# id lxj2
uid=(lxj2) gid=(root) groups=(root)
[root@rhel7 ~]# groupmems -a lxj2 -g sales
[root@rhel7 ~]# id lxj2
uid=(lxj2) gid=(root) groups=(root),(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
linux groupmems命令的更多相关文章
- linux grep命令
linux grep命令1.作用Linux系统中grep命令是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹 配的行打印出来.grep全称是Global Regular Expressio ...
- Linux常用命令(一)
Linux常用命令 1. pwd查看当前路径(Print Working Directory) [root@CentOS ~]# pwd/root 2. cd .. 返回上一级 .. 表示上一级 ...
- Linux下命令行安装weblogic10.3.6
Linux下命令行安装weblogic10.3.6 一.安装前准备工作: 1.创建用户useradd weblogic;创建用户成功linux系统会自动创建一个和用户名相同的分组,并将该用户分到改组中 ...
- Linux paste命令
Linux paste命令用于合并文件的列. paste指令会把每个文件以列对列的方式,一列列地加以合并. 语法 paste [-s][-d <间隔字符>][--help][--versi ...
- 20145222《信息安全系统设计基础》Linux常用命令汇总
学习Linux时常用命令汇总 通过Ctrl+f键可在该网页搜索到你想要的命令. Linux中命令格式为:command [options] [arguments] //中括号代表是可选的,即有些命令不 ...
- Linux sudo 命令的应用
.note-content { font-family: "Helvetica Neue", Arial, "Hiragino Sans GB", STHeit ...
- linux 基础命令与文件管理
Linux终端介绍 Shell提示符 Bash Shell基本语法 基本命令的使用:ls.pwd.cd 查看系统和BIOS硬件时间 Linux如何获得帮助 Linux关机命令:shutdow.in ...
- linux awk命令详解
linux awk命令详解 简介 awk是一个强大的文本分析工具,相对于grep的查找,sed的编辑,awk在其对数据分析并生成报告时,显得尤为强大.简单来说awk就是把文件逐行的读入,以空格为默认分 ...
- linux常用命令的介绍
本文主要介绍Linux常用命令工具,比如用户创建,删除,文件管理,常见的网络命令等 如何创建账号: 1. 创建用户 useradd -m username -m 表示会在/home 路径下添加创建用户 ...
随机推荐
- Hibernate中分页
query.setFirstResult(4);query.setMaxResults(5); 这两个方法就是hibernate的分页
- jsp <%! %> 与 <% %> 区别
转自huangqiqing123.iteye.com/blog/1922014 <body> <%! //1.可定义方法 public String outMethod(){ ret ...
- margin-top在IE与其他浏览器下的不同
两个box,box1嵌套box2, box2使用margin-top在IE下与其他浏览器不同.待整理
- iOS开发,新手入门指导
在做了近两年wp,安卓开发之后,某一天突然决定投身iOS的开发之中. 因为一直用的mac,做wp开发的时候都用双系统,vs开久了,就会比较烫,这点让人不爽.后来更多地做安卓,直接mac下开发,很舒适的 ...
- ls命令解析
ls 列出目录的内容.它可是我们所经常使用的命令,那么你了解它所有的功能吗?下面让我们来看看吧! 命令格式 ls [OPTION]... [FILE]... 参数说明 -a , --all 显示所有文 ...
- 常用排序算法总结(C#版)
首先,说说几个排序中的概念. 1.稳定排序和非稳定排序 简单地说就是所有相等的数经过某种排序方法后,仍能保持它们在排序之前的相对次序,我们就说这种排序方法是稳定的.反之,就是非稳定的. 比如:一组数 ...
- centos git 升级应用
在阿里云服务器上部署Git 升级centos 自带的Git yum库自带版本为git1.7.1-3.el6_4.1. -------------------升级-------------------- ...
- Uncaught SyntaxError: Unexpected end of input
js报错 原因:输入的意外终止…… 页面代码写的不规范啊……其中的某条语句,没有正常结束…… 或者部分语句“‘’”双引号,单引号没有配对好,被转义了之类的……错误造成的 代码: <script ...
- php xcache 配置 使用 (转载)
xcache的使用与配置 一.安装Xcache # wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz # t ...
- [Struts2学习笔记] -- 简单的类型转换
接下来学习一下Struts2简单的类型转换,Struts2基于ognl.jar实现了简单类型的数据转换.比如jsp页面中的form值与字段值的转换,下面写一个例子. 1.创建一个jsp页面,编写一个f ...