linux之/etc/default/useradd文件

/etc/default/useradd文件是在使用useradd添加用户时,一个需要调用的默认的配置文件之一,可以使用命令"useradd -D"进行修改。

useradd用法:

复制代码
[root@centos79-3 mail]# 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
  -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

[root@centos79-3 mail]# 

/etc/default/useradd文件

复制代码
[root@centos79-3 default]# pwd
/etc/default
[root@centos79-3 default]# cat useradd
# useradd defaults file
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes

[root@centos79-3 default]# 

|-----------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| key=value | 说明 |
| GROUP=100 | 用户默认GID.若是在添加新用户的时候没有指定GID,那么Linux系统有两种做法:一是把它添加到统一的组里面,就是这里的这个组;二是添加到和用户UID同名的GID中,即创建一个新的组且GID=HID.但是这些都不是可取的,最好的方法是每添加一个用户都应该想好,这个用户是属于那个部门(组)的,不应该出现一个不知道该放哪一个组的用户。 |
| HOME=/home | 指定缺省宿主目录存放的目录 |
| INACTIVE=-1 | 账户是否被禁用 -1:不禁用 0:禁用 |
| EXPIRE= | 账号失效时间,比如临时加入该项目的成员,添加临时账户,那么项目完成后就让这些临时账户失效;不设置表示永久有效 |
| SHELL=/bin/bash | 缺省使用的shell |
| SKEL=/etc/skel | 新用户宿主目录下的文件存放路径 |
| CREATE_MAIL_SPOOL=yes | 新用户是否要创建一个和用户同名的保存邮件信息的文件 |
[/etc/default/useradd文件说明]

相关推荐
c无序4 分钟前
【Docker-13】Docker Container容器
运维·docker·容器
Sunlight_7776 分钟前
第五章 SQLite数据库:1、SQLite 基础语法及使用案例
java·linux·服务器·jvm·数据库·tcp/ip·sqlite
Silence4Allen9 分钟前
Ubuntu 安装WPS Office
linux·ubuntu·wps
程序员JerrySUN38 分钟前
驱动开发硬核特训 · Day 11(下篇):从 virtio_blk 看虚拟总线驱动模型的真实落地
linux·驱动开发·嵌入式硬件
半兽先生1 小时前
CentOS 中安装 vim
linux·centos·vim
云达闲人1 小时前
Proxmox VE 用户与权限管理命令大全
运维·网络·云原生·容器·proxmox·用户权限管理·命令大全
喆星时瑜2 小时前
【Docker】运行错误提示 unknown shorthand flag: ‘d‘ in -d ----详细解决方法
运维·docker·容器
长流小哥2 小时前
Linux网络编程实战:从字节序到UDP协议栈的深度解析与开发指南
linux·c语言·开发语言·网络·udp
极小狐3 小时前
极狐GitLab 功能标志详解
linux·运维·服务器·elasticsearch·gitlab·极狐gitlab
jinan8863 小时前
加密软件的发展:从古典密码到量子安全
大数据·运维·服务器·网络·安全·web安全