ubuntu adduser

添加用户 hexan 到目录 /home/hexan 下。
$ sudo adduser hexan -home /home/hexan

添加一个普通用户
adduser [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
[--firstuid ID] [--lastuid ID] [--gecos GECOS] [--ingroup GROUP | --gid ID]
[--disabled-password] [--disabled-login] USER

添加一个系统用户
adduser --system [--home DIR] [--shell SHELL] [--no-create-home] [--uid ID]
[--gecos GECOS] [--group | --ingroup GROUP | --gid ID] [--disabled-password]
[--disabled-login] USER

添加一个用户组
adduser --group [--gid ID] GROUP
addgroup [--gid ID] GROUP

添加一个系统组
addgroup --system [--gid ID] GROUP

添加一个已经存在的用户到一个已经存在的组里
adduser USER GROUP

通用选项:
  --quiet | -q     安静模式,不显示处理的过程信息
  --force-badname  运行用户名不匹配系统配置变量
                   NAME_REGEX[_SYSTEM]
  --help | -h      帮助信息
  --version | -v   版本和版权信息
  --conf | -c FILE 使用 FILE 作为配置文件

转自:http://www.diybl.com/course/6_system/linux/Linuxjs/200897/139974.html

将一个用户添加到用户组中,千万不能直接用: 
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

============== End

ubuntu adduser的更多相关文章

  1. 初始设置ubuntu 16.04 Vps部署rails

    参考 https://blog.longwin.com.tw/2005/12/ssh_keygen_no_passwd/ 1 选择搬瓦工左边菜单栏中的“Root password modificati ...

  2. ubuntu 权限不够,解决办法,无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用)

    终端执行  sudo passwd root输入root 新密码执行命令  nano /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf末行添加   gr ...

  3. add user

    ubuntu adduser deploy usermod -a -G sudo deploy centos adduser deploy passwd deploy usermod -a -G wh ...

  4. 【linux】linux创建用户并授予sudo权限

    1. 新建用户 root@ubuntu:~# adduser hadoop root@ubuntu:~# passwd hadoop #为hadoop用户设置密码 2. 为hadoop用户添加sudo ...

  5. Images之Dockerfiles

    Best practices for writing Dockerfiles This document covers recommended best practices and methods f ...

  6. 8、Dockerfile介绍和最佳实践

    一.Dockerfile 概念 1.Dockerfile是什么 Docker 镜像是一个特殊的文件系统,除了提供容器运行时所需的程序.库.资源.配置等文件外,还包含了一些为运行时准备的一些配置参数(如 ...

  7. Docker中的Dockerfile命令详解FROM RUN COPY ADD ENTRYPOINT...

    Dockerfile指令 这些建议旨在帮助您创建高效且可维护的Dockerfile. FROM FROM指令的Dockerfile引用 尽可能使用当前的官方图像作为图像的基础.我们推荐Alpine图像 ...

  8. ubuntu用户添加adduser, useradd

    ubuntu和windows一样,可以任意创建或者删除新的用户,windows下比较简单,ubuntu下需要使用命令,不过操作起来不是很繁琐,所以我尽量写的详细一些.  如何创建ubuntu新用户? ...

  9. Ubuntu中useradd和adduser的区别

    在Ubuntu中创建新用户,通常会用到两个命令:useradd和adduser,虽然作用一样,但用法却不尽相同.本文接下来便为读者带来具体的解释. AD:51CTO学院:IT精品课程在线看! 在Ubu ...

随机推荐

  1. html模板 练习(仿照抽屉网)

    1.页面布局 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UT ...

  2. [SDOI2010]地精部落 DP

    LG传送门 DP好题 题意很简单,就是求1-n的排列,满足一个数两边的数要么都比它大要么都比它小,求这样的排列个数对\(p\)取膜的值(为了表述简单,我们称这样的排列为波动序列). 这个题我第一眼看到 ...

  3. DSP28335做FFT傅里叶变换

    1. 看了一下例程,居然没有FFT的例程,难道这个DSP28335不能做FFT吗?对了C2000系列是有C2000 ware这个库的.方便很多,不过目前不确定在C5000上运行的FFT能直接迁移到DS ...

  4. tensorflow中tensor与数组之间的转换

    # 主要是两个方法: # 1.数组转tensor:数组a, tensor_a=tf.convert_to_tensor(a) # 2.tensor转数组:tensor b, array_b=b.eva ...

  5. Linux 安装ActiveMQ(使用Mac远程访问)

    阅读本文需要安装JDK 一 ActiveMQ简介 activemq是用java语言编写的一款开源消息总线 activemq是apache出品 activemq消息的传递有两种类型 一种是点对点: 即一 ...

  6. 母版页 MasterPage

    母版页是一个扩展名为.master的ASP.NET文件,主要是为了应用程序创建统一的用户功能界面和样式. ContentPlaceHolder控件只能在母版页中使用,在平常的web页面使用,会发生解析 ...

  7. PHPCMS如何让手机站点取消浏览大图直接加载原图

    一.然后找到phpcms\modules\wap\functions\global.func.php 文件,找到相关代码,如下图: return '<img src="'.thumb( ...

  8. 美国警察iPhone数据线挡住歹徒子弹获救

    泡泡网手机频道11月1日 现在手机的功能越来越丰富,不仅可以接打电话.收发短信.玩游戏聊天,关键时刻还能救命.前天HTC手机再次忠心护主,让许多同学对HTC赞赏有加.而现在又有人捡了一条命,不过这次救 ...

  9. CodeForces 508E Arthur and Brackets 贪心

    题目: E. Arthur and Brackets time limit per test 2 seconds memory limit per test 128 megabytes input s ...

  10. map的默认排序和自定义排序

    STL的容器map为我们处理有序key-value形式数据提供了非常大的便利,由于内部红黑树结构的存储,查找的时间复杂度为O(log2N). 一般而言,使用map的时候直接采取map<typen ...