centos useradd 命令详解

useradd 命令

Usage: useradd [options] LOGIN
       useradd -D
       useradd -D [options]

Options:
  -b, --base-dir BASE_DIR       base directory for the home directory of the
                                new account
  -c, --comment COMMENT         GECOS field of the new account
  -d, --home-dir HOME_DIR       home directory of the new account
  -D, --defaults                print or change default useradd configuration
  -e, --expiredate EXPIRE_DATE  expiration date of the new account
  -f, --inactive INACTIVE       password inactivity period of the new account
  -g, --gid GROUP               name or ID of the primary group of the new
                                account
  -G, --groups GROUPS           list of supplementary groups of the new
                                account
  -h, --help                    display this help message and exit
  -k, --skel SKEL_DIR           use this alternative skeleton directory
  -K, --key KEY=VALUE           override /etc/login.defs defaults
  -l, --no-log-init             do not add the user to the lastlog and
                                faillog databases
  -m, --create-home             create the user‘s home directory
  -M, --no-create-home          do not create the user‘s home directory
  -N, --no-user-group           do not create a group with the same name as
                                the user
  -o, --non-unique              allow to create users with duplicate
                                (non-unique) UID
  -p, --password PASSWORD       encrypted password of the new account
  -r, --system                  create a system account
  -R, --root CHROOT_DIR         directory to chroot into
  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files
  -s, --shell SHELL             login shell of the new account
  -u, --uid UID                 user ID of the new account
  -U, --user-group              create a group with the same name as the user
  -Z, --selinux-user SEUSER     use a specific SEUSER for the SELinux user mapping

常用:

a)

useradd testuser -c "c参数后面接注释信息" -p "用户密码"

b)

useradd testuser -M -s /sbin/nologin

#用户testuser 没有家目录,也不可以登陆

c)

删除用户userdel -r testuser

详细参考:https://www.cnblogs.com/whitehorse/p/5847278.html

原文地址:https://www.cnblogs.com/faberbeta/p/linux-shell022.html

时间: 2024-08-01 09:58:37

centos useradd 命令详解的相关文章

CentOS tree命令详解

inux下tree命令详解---linux以树状图逐级列出目录的内容命令 #############################################################################命令格式 tree <选项或者是参数> <分区或者是目录> #############################################################################(1) tree 最长使用的参数或者是选项 

centos alias命令详解

Alias命令 功能描述:我们在进行系统的管理工作一定会有一些我们经常固定使用,但又很长的命令.那我们可以给这些这一长串的命令起一个别名.之后还需要这一长串命令时就可以直接以别名来替代了.系统中已经有一些默认的命令别名.可以alias来查看.也可以查看家目录下的~/.bash_profile来查看,这个是属于用户个人的别名.如果要定义全局的别名,可以将定义写入/etc/bashrc档案中.通过alias去的别名,在系统重新启动过后会自动清除.修改后,要source一下才会生效. 语法:alias

useradd命令详解

1.作用useradd命令用来建立用户帐号和创建用户的起始目录,使用权限是终极用户.2.格式useradd [-d home] [-s shell] [-c comment] [-m [-k template]] [-f inactive] [-e expire ] [-p passwd] [-r] name3.主要参数-c:加上备注文字,备注文字保存在passwd的备注栏中. -d:指定用户登入时的启始目录.-D:变更预设值.-e:指定账号的有效期限,缺省表示永久有效.-f:指定在密码过期后多

useradd命令详解(转)

1.作用 useradd或adduser命令用来建立用户帐号和创建用户的起始目录,使用权限是超级用户. 2.格式 useradd [-d home] [-s shell] [-c comment] [-m [-k template]] [-f inactive] [-e expire ] [-p passwd] [-r] name 3.主要参数 -c:加上备注文字,备注文字保存在passwd的备注栏中. -d:指定用户登入时的主目录,替换系统默认值/home/<用户名> -D:变更预设值. -

centos top 命令详解及退出top命令-使用p键及free命令

1.作用 top命令用来显示执行中的程序进程,使用权限是所有用户. 2.格式 top [-] [d delay] [q] [c] [S] [s] [i] [n] 3.主要参数 d:指定更新的间隔,以秒计算. q:没有任何延迟的更新.如果使用者有超级用户,则top命令将会以最高的优先序执行. c:显示进程完整的路径与名称. S:累积模式,会将己完成或消失的子行程的CPU时间累积起来. s:安全模式. i:不显示任何闲置(Idle)或无用(Zombie)的行程. n:显示更新的次数,完成后将会退出t

CentOS Yum 命令详解

rpm安装缺点: 总所周知,Redhat和Fedora的软件安装命令是rpm.需要手动寻找安装该软件所需要的一系列依赖关系,超级麻烦不说,要是软件不用了需要卸载的话由于卸载掉了某个依赖关系而导致其他的软件不能用是非常恼人的.令人高兴是,Fedora终于推出了类似于ubuntu中的apt的命令yum,令Fedora的软件安装变得简单容易. yum优点: 可以同时配置多个资源库(Repository) 简洁的配置文件(/etc/yum.conf) 自动解决增加或删除rpm包时遇到的倚赖性问题 使用方

Linux学习篇之---CentOS Yum命令详解

yum有以下特点: *可以同时配置多个资源库(Repository) *简洁的配置文件(/etc/yum.conf) *自动解决增加或删除rpm包时遇到的倚赖性问题 *使用方便 *保持与RPM数据库的一致性 yum,是Yellow dog Updater Modified的简称,起初是由yellow dog这一发行版的开发者Terra Soft研发,用python写成,那时还叫做yup(yellow dog updater),后经杜克大学的[email protected]开发团队进行改进,遂有

useradd 命令详解

useradd 作用: 用于Linux中创建的新的系统用户, useradd 可用来建立用户账号, 账号建好之后,再用passwd 设定账号的密码, 可用userdel 删除账号. 使用useradd 指令创建的账号,实际上保存在/etc/passwd文本文件中. 选项: -c :备注文字, 显示在passwd 备注栏位中 -d :指定用户登入时的起始目录 -D :变更预设值 -e : 指定账号的有效期限 -f: 指定在密码过期后多少天关闭该账号 -g : 指定用户所属的群组 -G : 指定用户

【转】centos关机与重启命令详解

连接:http://blog.csdn.net/jiangzhengdong/article/details/8036594 Linux centos关机与重启命令详解与实战 Linux centos重启命令: 1.reboot 2.shutdown -r now 立刻重启(root用户使用) 3.shutdown -r 10 过10分钟自动重启(root用户使用) 4.shutdown -r 20:35 在时间为20:35时候重启(root用户使用) 如果是通过shutdown命令设置重启的话