将一个用户添加到用户组中,千万不能直接用:
usermod -G groupA

这样做会使你离开其他用户组,仅仅做为 这个用户组 groupA 的成员。
应该用 加上 -a 选项:
usermod -a -G groupA user

(FC4: usermod -G groupA,groupB,groupC user)
-a 代表 append, 也就是 将自己添加到 用户组groupA 中,而不必离开 其他用户组。

命令的所有的选项,及其含义:
Options:
-c, --comment COMMENT         new value of the GECOS field
-d, --home HOME_DIR           new home directory for the user account
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE       set password inactive after expiration
to INACTIVE
-g, --gid GROUP               force use GROUP as new primary group
-G, --groups GROUPS           new list of supplementary GROUPS
-a, --append          append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, --help                    display this help message and exit
-l, --login NEW_LOGIN         new value of the login name
-L, --lock                    lock the user account
-m, --move-home               move contents of the home directory to the new
location (use only with -d)
-o, --non-unique              allow using duplicate (non-unique) UID
-p, --password PASSWORD       use encrypted password for the new password
-s, --shell SHELL             new login shell for the user account
-u, --uid UID                 new UID for the user account
-U, --unlock                  unlock the user account

查看用户所属的组使用命令:$ groups user

或者查看文件:$ cat /etc/group

Centos下添加用户到用户组的更多相关文章

  1. 嵌入式环境:CentOS下添加用户并且让用户获得root权限

    CentOS下添加用户并且让用户获得root权限 http://www.centoscn.com/CentOS/config/2014/0810/3471.html 1.添加用户,首先用adduser ...

  2. Linux下添加用户及用户组

    创建用户组hdpgroup: $ sudo addgroup hdpgroup 如果用户hdp不存在,把hdp添加到hdpgroup用户组: $ sudo adduser --force -ingro ...

  3. [转] CentOS下添加用户并且让用户获得root权限

    http://www.centoscn.com/CentOS/config/2014/0810/3471.html 1.添加用户,首先用adduser命令添加一个普通用户,命令如下: #adduser ...

  4. CentOS下添加用户并且让用户获得root权限

    转自:https://blog.csdn.net/tropicofcancer9/article/details/53926920 1.添加用户,首先用adduser命令添加一个普通用户,命令如下: ...

  5. Centos下添加用户并赋权

    创建新用户 创建一个用户名为:linuxidc [root@localhost ~]# adduser linuxidc 为这个用户初始化密码,linux会判断密码复杂度,不过可以强行忽略: [roo ...

  6. Centos下新建用户及修改用户目录

    Centos下新建用户及修改用户目录 Hillgo 关注 2015.09.22 01:32* 字数 154 阅读 3492评论 0喜欢 3 添加及删除用户 添加用户 test: adduser tes ...

  7. linux下添加用户到sudo组 并禁止sudo用户修改密码

    linux下添加用户到sudo组 创建用户  useradd hanli 为新用户设置密码  passwd hanli 创建用户组  groupadd  op 将用户添加到用户组  usermod - ...

  8. Linux下的用户和用户组,文件权限:chown和chmod

    如下图所示,root权限下新建一个用户MasterBai, /etc/passwd文件中新加入一些信息 这个文件中,记录了该服务器的用户信息,如下图红色框起来的用户,就是我们自己创建的用户,而起来2- ...

  9. 6-查看centos中的用户和用户组

    转载自:http://www.cnblogs.com/ermao0423/p/9510636.html 查看centos中的用户和用户组 1.用户列表文件:/etc/passwd/ 2.用户组列表文件 ...

随机推荐

  1. 微信小程序--每个独立的page的page.json只能修改window属性

    app.json 配置项列表 app.json文件用来对微信小程序进行全局配置,决定页面文件的路径.窗口表现.设置网络超时时间.设置多 tab 等. window配置 用于设置小程序的状态栏.导航条. ...

  2. Leetcode704.Binary Search二分查找

    给定一个 n 个元素有序的(升序)整型数组 nums 和一个目标值 target  ,写一个函数搜索 nums 中的 target,如果目标值存在返回下标,否则返回 -1. 示例 1: 输入: num ...

  3. Subsets 集合子集 回溯

    Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be ...

  4. SQLServer —— datediff 函数计算俩个日期差

  5. java memory allocation(转)

    Java的运行时数据存储机制 Java程序在运行时需要为一系列的值或者对象分配内存,这些值都存在什么地方?用什么样的数据结构存储?这些数据结构有什么特点?本文试图说明此命题的皮毛之皮毛. 概念   对 ...

  6. python中的输入和输出

    输入和输出   输出: 用print()在括号中加上字符串,就可以向屏幕上输出指定的文字.比如输出'hello, world',用代码实现如下: >>> print('hello, ...

  7. ubuntukylin-16.04安装

    目录 安装 虚拟机安装 系统安装 vmware tools 安装 优化 1.切换软件源 2.软件源和软件更新 3.vim插件 4.安装Sublime Text 3 5.安装福昕阅读器 6.安装Anac ...

  8. 2018-8-29-Roslyn-通过-Target-修改编译的文件

    title author date CreateTime categories Roslyn 通过 Target 修改编译的文件 lindexi 2018-08-29 09:10:46 +0800 2 ...

  9. 威胁快报|首爆,新披露Jenkins RCE漏洞成ImposterMiner挖矿木马新“跳板”

    简介 阿里云安全于近日捕获到一起使用Jenkins RCE漏洞进行攻击的挖矿事件.除挖矿外,攻击者还曾植入具有C&C功能的tsunami木马,也预留了反弹shell的功能,给用户带来极大安全隐 ...

  10. AtCoder Beginner Contest 064 D - Insertion

    AtCoder Beginner Contest 064 D - Insertion Problem Statement You are given a string S of length N co ...