首页 > 试题广场 >

创建用户时不指定用户主目录的参数( )

[单选题]
创建用户时不指定用户主目录的参数(      )
  • useradd -o
  • useradd -m
  • useradd -M
  • useradd -d
参数 全称 释义
-b base-dir BASE_DIR 新账户的主目录的基目录
-c comment COMMENT 新账户的 GECOS 字段
-d home-dir HOME_DIR 新账户的主目录
-D defaults 显示或更改默认的 useradd 配置
-e expiredate EXPIRE_DATE 新账户的过期日期
-f inactive INACTIVE 新账户的密码不活动期
-g gid GROUP 新账户主组的名称或 ID
-G groups GROUPS 新账户的附加组列表
-h help 显示此帮助信息并推出
-k skel SKEL_DIR 使用此目录作为骨架目录
-K key KEY=VALUE 不使用 /etc/login.defs 中的默认值
-l no-log-init 不要将此用户添加到最近登录和登录失败数据库
-m create-home 创建用户的主目录
-M no-create-home 不创建用户的主目录
-N no-user-group 不创建同名的组
-o non-unique 允许使用重复的 UID 创建用户
-p password PASSWORD 加密后的新账户密码
-r system 创建一个系统账户
-s shell SHELL 新账户的登录 shell
-u uid UID 新账户的用户 ID
-U user-group 创建与用户同名的组
-Z selinux-user SEUSER 为 SELinux 用户映射使用指定 SEUSER
发表于 2019-08-06 13:18:11 回复(3)
这么多,我学要记住吗???😔
发表于 2020-08-09 14:12:30 回复(2)

当使用useradd命令创建用户时,可以通过-d选项来指定用户主目录的位置。如果没有显式指定,则默认会在/home目录下创建同名的用户主目录。

选项说明如下:

  • -o:允许用户ID(UID)不唯一,即与现有用户ID相同。
  • -m:创建用户时同时创建用户主目录。
  • -M:不要创建用户主目录。
发表于 2023-11-01 10:41:51 回复(0)
[root@master ~]# useradd --help
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
  -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

发表于 2019-09-25 18:51:57 回复(0)