添加用户username到sudo组:

sudo usermod -aG sudo username
USERMOD(8)                                  系统管理命令                                 USERMOD(8)

名
usermod - 修改一个用户账户 大
usermod [选项] 登录 描
usermod 修改系统账户文件和在命令行上指定的相关更改。 选
usermod 可以接受的选项有: -a, --append
将用户添加到附加组。只能和 -G 选项一起使用。 -c, --comment COMMENT
用户密码文件中注释字段的新值。通常使用 chfn(1) 工具对其进行修改。 -d, --home HOME_DIR
用户的新登录目录。 如果给了 -m 选项,当前主目录的内容将会移动到新主目录中,如果不存在,则创建。 -e, --expiredate EXPIRE_DATE
用户账户将被禁用的日期。日期以 YYYY-MM-DD 格式指定。 空 EXPIRE_DATE 参数将禁用账户过期。 此选项需要一个 /etc/passwd 文件。如果没有,将会创建一条 /etc/shadow 项目。 -f, --inactive INACTIVE
密码过期之后,账户被彻底禁用之前的天数。 0 表示密码过期时,立即禁用账户;-1 表示不使用这个功能。 此选项需要一个 /etc/passwd 文件。如果没有,将会创建一条 /etc/shadow 项目。 -g, --gid GROUP
用户的新初始登录组的组名或数字代号。此组必须存在。 用户主目录中,属于原来的主组的文件将转交新组所有。 主目录之外的文件所属的组必须手动修改。 -G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
用户还属于的附加组列表。组之间使用逗号分隔,没有空格。这些组需要遵守和 -g 选项中给的组同
样的限制。 如果用户当前是一个组的成员,而这个组没有列在这里,用户将被从那个组里便删除。这个行为可以
通过 -a 选项修改,这使用户追加到给出的附加组列表中。 -l, --login NEW_LOGIN
用户的名称将会从 LOGIN 修改为 NEW_LOGIN。不会更改别的任何东西。特别是,用户的主目录名和
邮件池也需要手动修改以和新登录名对应。 -L, --lock
锁定用户的密码。这会在用户加密的密码之前放置一个“!”,可以快速禁用密码。您可以和 -p 或 -U
配合使用此选项。 注意:如果希望锁定账户(不仅仅是通过密码访问),您也需要设置 EXPIRE_DATE 为 1。 -m, --move-home
将用户的主目录移动到新位置。 这个选项只有和 -d (或 --home) 选项组合使用时才有效。 usermod 会改写文件的属主并复制模式、ACL 和扩展属性,但是稍后也可能需要手动修改。 -o, --non-unique
使用 -u 选项时,可以将用户 ID 改为非唯一的值。 -p, --password PASSWORD
已经加密过的密码,就像 crypt(3) 返回的那样。 注 密码将会写到本地的 /etc/passwd 或 /etc/shadow 文件。这可能会与您的机器有所不同,这根据
PAM 配置中的密码数据库配置而定。 您应该确保密码符合系统的密码政策。 -R, --root CHROOT_DIR
Apply changes in the CHROOT_DIR directory and use the configuration files from the
CHROOT_DIR directory. -s, --shell SHELL
用户的新登录 shell 的名称。将此字段设置为空会让系统选择默认的登录 shell。 -u, --uid UID
用户 ID 的新数值。 这个值必须是唯一的,除非使用了 -o 选项,必须是非负值。 用户的邮箱,用户主目录中属于此用户的文件的属主 ID 也将自动更改。 用户主目录之外文件所有权必须手动修复。 不会对 /etc/login.defs 中的 UID_MIN, UID_MAX, SYS_UID_MIN 和 SYS_UID_MAX 进行检查。 -U, --unlock
解锁用户的密码。这将移除加密的密码之前的“!”。您可以将此选项和 -p 或 -L 配合使用。 注意:如果您希望解锁账户(不只是使用密码访问),您也应该设置 EXPIRE_DATE (例如设置为
99999,或者 /etc/default/useradd 中的 EXPIRE 值)。 -v, --add-subuids FIRST-LAST
Add a range of subordinate uids to the user's account. This option may be specified multiple times to add multiple ranges to a users account. No checks will be performed with regard to SUB_UID_MIN, SUB_UID_MAX, or SUB_UID_COUNT
from /etc/login.defs. -V, --del-subuids FIRST-LAST
Remove a range of subordinate uids from the user's account. This option may be specified multiple times to remove multiple ranges to a users
account. When both --del-subuids and --add-subuids are specified, the removal of all
subordinate uid ranges happens before any subordinate uid range is added. No checks will be performed with regard to SUB_UID_MIN, SUB_UID_MAX, or SUB_UID_COUNT
from /etc/login.defs. -w, --add-subgids FIRST-LAST
Add a range of subordinate gids to the user's account. This option may be specified multiple times to add multiple ranges to a users account. No checks will be performed with regard to SUB_GID_MIN, SUB_GID_MAX, or SUB_GID_COUNT
from /etc/login.defs. -W, --del-subgids FIRST-LAST
Remove a range of subordinate gids from the user's account. This option may be specified multiple times to remove multiple ranges to a users
account. When both --del-subgids and --add-subgids are specified, the removal of all
subordinate gid ranges happens before any subordinate gid range is added. No checks will be performed with regard to SUB_GID_MIN, SUB_GID_MAX, or SUB_GID_COUNT
from /etc/login.defs. -Z, --selinux-user SEUSER
用户登陆的 SELinux 用户。 空的 SEUSER 将移除用户 LOGIN 的 SELinux 用户映射(如果有)。 CAVEATS
You must make certain that the named user is not executing any processes when this command
is being executed if the user's numerical user ID, the user's name, or the user's home
directory is being changed. usermod checks this on Linux. On other platforms it only uses
utmp to check if the user is logged in. 您必须手动更改 crontab 文件或 at 作业的属主。 您必须更改 NIS 服务器上的 NIS 相关内容。 配
在 /etc/login.defs 中有如下配置变量,可以用来更改此工具的行为: MAIL_DIR (string)
邮箱目录。修改或删除用户账户时需要处理邮箱,如果没有指定,将使用编译时指定的默认值。 MAIL_FILE (string)
定义用户邮箱文件的位置(相对于主目录)。 MAIL_DIR and MAIL_FILE 变量由 useradd,usermod 和 userdel 用于创建、移动或删除用户邮箱。 MAX_MEMBERS_PER_GROUP (number)
每个组条目的最大成员数。达到最大值时,在 /etc/group 开始一个新条目(行)(使用同样的名
称,同样的密码,同样的 GID)。 默认值是 0,意味着组中的成员数没有限制。 此功能(分割组)允许限制组文件中的行长度。这对于确保 NIS 组的行比长于 1024 字符。 如果要强制这个限制,可以使用 25。 注意:分割组可能不受所有工具的支持(甚至在 Shadow 工具集中)。您不应该使用这个变量,除非真
的需要。 SUB_GID_MIN (number), SUB_GID_MAX (number), SUB_GID_COUNT (number)
If /etc/subuid exists, the commands useradd and newusers (unless the user already have
subordinate group IDs) allocate SUB_GID_COUNT unused group IDs from the range
SUB_GID_MIN to SUB_GID_MAX for each new user. The default values for SUB_GID_MIN, SUB_GID_MAX, SUB_GID_COUNT are respectively 100000,
600100000 and 10000. SUB_UID_MIN (number), SUB_UID_MAX (number), SUB_UID_COUNT (number)
If /etc/subuid exists, the commands useradd and newusers (unless the user already have
subordinate user IDs) allocate SUB_UID_COUNT unused user IDs from the range SUB_UID_MIN
to SUB_UID_MAX for each new user. The default values for SUB_UID_MIN, SUB_UID_MAX, SUB_UID_COUNT are respectively 100000,
600100000 and 10000. 文
/etc/group
组账户信息。 /etc/gshadow
安全组账户信息。 /etc/login.defs
Shadow 密码套件配置。 /etc/passwd
用户账户信息。 /etc/shadow
安全用户账户信息。 /etc/subgid
Per user subordinate group IDs. /etc/subuid
Per user subordinate user IDs. 参
chfn(1), chsh(1), passwd(1), crypt(3), gpasswd(8), groupadd(8), groupdel(8), groupmod(8),
login.defs(5), subgid(5), subuid(5), useradd(8), userdel(8). shadow-utils 4.5 2018-01-25 USERMOD(8)

添加用户username到sudo组的更多相关文章

  1. Ubuntu新建用户并加入SUDO组

    Ubuntu新建用户并加入SUDO组 新建用户: adduser xxxx 加入用户组: usermod -aG sudo username

  2. CoreOS 添加用户并赋予sudo权限

    使用root账号登录CoreOS username 为你要添加的用户登录名 添加用户到root组 useradd -g rot username 添加 sudo 权限 visudo -f /etc/s ...

  3. RHEL7 添加用户,含sudo权限

    1.添加普通用户[root@server ~]# useradd book //添加一个名为book的用户 [root@server ~]# passwd book //修改密码 Changing p ...

  4. CentOS添加用户并加入sudo权限

    # 新增用户 useradd username # 设置密码 passwd username # 加入sudo ## 打开sudo配置文件 visudo ## 找到下面这两行,并在下面新增红色部分 # ...

  5. CentOS添加用户及赋予sudo权限

    在CentOS下添加一个用户假设用户名:username 密码:userpwd 新建用户: adduser username 修改密码: passwd username 根据提示重复输入两遍userp ...

  6. linux下添加用户到sudo组

    #查看当前用户所属组groups #查看指定用户hiuser所属组groups hiuser #添加用户hiuser到sudo组sudo usermod -G sudo hiuser

  7. 转:ubuntu添加用户adduser,并给予sudo权限

    ubuntu添加用户adduser,并给予sudo权限 如何创建ubuntu新用户? 首先打开终端,输入:sudo adduser username正在添加用户“username”... 正在添加新组 ...

  8. 添加用户到 sudo

    sudo 简介: 在 Linux 中系统管理员可以通过 sudo 实用程序让用户或组能够作为另一个用户运行命令.换句话说,可以分派命令特权,而不需要另一个用户的密码.root 用户通过在 /etc/s ...

  9. Linux 将一般的用户加入sudo组is_not_in_the_sudoers_file._This_incident_will_be_reported解决方法

      在一般用户下执行sudo命令提示xxx is not in the sudoers file. This incident will be reported.解决方法:        $where ...

随机推荐

  1. Django SimpleCMDB WSGI

    一.WSGI 介绍 (1) 在前面的学习中,我们是通过 python manage.py runserver 0.0.0.0:8000 来启动并访问开发服务器的:(2) 但在实际中我们是通过直接访问 ...

  2. 转:Android开发:使用DDMS Heap进行内存泄露调试

    无论怎么小心,想完全避免bad code是不可能的,此时就需要一些工具来帮助我们检查代码中是否存在会造成内存泄漏的地方.Android tools中的DDMS就带有一个很不错的内存监测工具Heap,本 ...

  3. 解决nginx中fastcgi(php-fpm)60s超时的问题

    在配置中加上 location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_read_timeout 700; fastcgi_ ...

  4. spring基础---->spring自定义初始化(二)

    这里新增了对ref属性的支持,并且过滤了已经解析的元素.人生有两个词很棒,一言不合和不提也罢. spring自定义对ref属性支持 项目的结构如下:新增一个ThirdBean类,修改了ParseXml ...

  5. Github for Windows 登录时报代理问题?

    Github for Windows 登录时报如下错误: 不要被它的提示信息误导了. 登录失败,跟代理半毛钱关系都没有. 是 .net framework 组件 的问题. 更新下 .net frame ...

  6. tar解压包的时候出现错误 gzip: stdin: not in gzip format

    在Linux环境下,通过tar -zxvf 命令解压文件时遇到”gzip: stdin: not in gzip format“等错误:如图所示 root@cmfchina:/usr/java# ta ...

  7. LeetCode 33 Search in Rotated Sorted Array(循环有序数组中进行查找操作)

    题目链接 :https://leetcode.com/problems/search-in-rotated-sorted-array/?tab=Description   Problem :当前的数组 ...

  8. 【转】CCScale9Sprite和CCControlButton

    转自:http://blog.csdn.net/nat_myron/article/details/12975145 在2dx下用到了android下的.9.png图片,下面是原图   查了一下2dx ...

  9. gradle项目,连同依赖一起打jar包

    在build里加入以下配置(如果不是一个可执行的jar包的话就不用配置Main-Class属性): def mainClassName = "你需要执行的main方法所在的的包名+类名&qu ...

  10. Implicit conversion from enumeration type 'enum CGImageAlphaInfo' to different enumeration type 'CGBitmapinfo' (aka) 'enum CGBitmapInfo')

    The constants for specifying the alpha channel information are declared with the CGImageAlphaInfo ty ...