添加用户 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

【转】 ubuntu adduser 命令学习相关推荐

  1. ubuntu nohup命令学习

    ubuntu nohup命令学习 最近在使用xshell连接服务器使用,条件限制只能用wifi连接,且信号不好,xshell总是自己断开,则执行中的命令也会中断. 于是百度,了解到了ubuntu下有n ...

  2. ubuntu系统vim常用命令学习以及ubuntu软件下载安装

    文章目录 一.ubuntu系统vim常用命令学习 (一)进入进入vim编辑器的方式 (二)vi的三种工作方式 (三)退出vi的命令 (四)命令模式下的各种命令 1.光标移动命令 2.插入命令 3.删除 ...

  3. Ubuntu 命令学习一: 关机,重启

    Ubuntu 命令学习 关机命令 1.halt 立刻关机(一般加-p 关闭电源) 2.poweroff 立刻关机 3.shutdown -h now 立刻关机 4.shutdown -h 10 10分 ...

  4. Linux命令学习资料总结

    对 Linux 新手非常有用的 20 个命令 1. ls命令 ls命令是列出目录内容(List Directory Contents)的意思.运行它就是列出文件夹里的内容,可能是文件也可能是文件夹. ...

  5. Linux命令学习之一

    Linux命令 1.预览 cat chattr chgrp chmod chown cksum cmp diff diffstat file find git gitview indent cut l ...

  6. linux命令学习(转)

    查询命令的地方:man.linuxde.net/ Linux必学的60个命令 Linux提供了大量的命令,利用它可以有效地完成大量的工 作,如磁盘操作.文件存 Linux提供了大量的命令,利用它可以有 ...

  7. Java命令学习系列(三)——Jmap

    转载自 Java命令学习系列(三)--Jmap jmap是JDK自带的工具软件,主要用于打印指定Java进程(或核心文件.远程调试服务器)的共享对象内存映射或堆内存细节.可以使用jmap生成Heap ...

  8. Java命令学习系列(一)——Jps

    转载自 Java命令学习系列(一)--Jps jps位于jdk的bin目录下,其作用是显示当前系统的java进程情况,及其id号. jps相当于Solaris进程工具ps.不象"pgrep ...

  9. 使用adduser命令在Debian Linux中创建用户

    在本教程中,我们将学习如何使用命令行界面在Debian Linux中添加用户. Debian Linux使用adduser命令从命令行创建用户.使用adduser命令后跟用户名来创建具有默认选项的新用 ...

最新文章

  1. restapi如何传图片_iPhone传照片,不是只能用微信QQ,第二种方法很少人知道哦
  2. wxpython有没有可视化设计_wxPython - GUI Builder工具( GUI Builder Tools)
  3. 1007 Maximum Subsequence Sum(两种思路)
  4. Flutter是什么
  5. jstl sql标签使用
  6. 犀牛导出su文件错误插件错误_安利|一款免费插件blender-for-unrealengine
  7. Unity发布WebGl注意事项
  8. 【转】老男孩:Linux企业运维人员最常用150个命令汇总
  9. access control java_Java Access Controller
  10. 多线程中的互斥控制程序代码_Java中的并发——线程安全性
  11. 微课|中学生可以这样学Python(例8.22):冒泡法排序
  12. 海思Hi3519A SVP从入门到精通(一 概述)
  13. excel 画散点图 怎么设置图片的分辨率_【R语言】barplot柱状图+散点图+误差棒
  14. 插入u盘计算机未响应,U盘插入win7电脑没反应如何解决 Win7插入U盘没反应怎么办...
  15. linux GRO相关
  16. Android电话拦截及拦截提示音的实现
  17. 力扣刷题-python-动态规划-1 (动态规划、01背包问题、完全背包问题)
  18. 自动从头到尾播放清风dj网的代码
  19. 软件安全测试-web安全测试基础
  20. java预约功能_java网上预约功能怎么实现啊。。

热门文章

  1. python—多线程之死锁
  2. FileLocatorPro正则表达式批量搜索文件中的字符串
  3. VMprotect简介
  4. 编译器扩展SEH(1)
  5. vbs枚举磁盘访问磁盘信息
  6. Windows进程与线程学习笔记(六)—— 线程切换
  7. POJ 1611 -The Suspects (并查集)
  8. 【PAT乙级】1065 单身狗 (25 分)
  9. 【PAT乙级】1039 到底买不买 (20 分)
  10. 1.1操作系统的概念或功能