linux之/etc/default/useradd文件

简介: 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]#
/etc/default/useradd文件说明
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 新用户是否要创建一个和用户同名的保存邮件信息的文件
————————————————
版权声明:本文为CSDN博主「小黑要上天」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/z19861216/article/details/133220736

目录
相关文章
|
11天前
|
Linux 数据安全/隐私保护 Windows
命令方式:window向linux传文件
【10月更文挑战第6天】本文介绍了如何在Linux系统中通过命令`ip a`获取IP地址,并在Windows系统下使用CMD命令行工具和SCP命令实现文件传输。示例展示了如何将D盘中的`mm.jar`文件上传至IP地址为192.168.163.122的Linux系统的/up/目录下,最后在Linux系统中确认文件传输结果。
167 65
|
18天前
|
Linux Shell
Linux系统文件默认权限
Linux系统文件默认权限
34 2
|
10天前
|
Linux 开发工具 数据安全/隐私保护
linux异常一:feng 不在 sudoers 文件中,此事将被报告。yum提示Another app is currently holding the yum lock; waiting for
这篇文章介绍了在CentOS 7系统中安装Docker时遇到的两个常见问题及其解决方法:用户不在sudoers文件中导致权限不足,以及yum被锁定的问题。
23 2
linux异常一:feng 不在 sudoers 文件中,此事将被报告。yum提示Another app is currently holding the yum lock; waiting for
|
6天前
|
Linux Shell 数据库
Linux文件查找新姿势:总有一种你没见过
文件查找是Linux用户提升工作效率的关键技能。本文介绍了几种不常见的文件查找方法,包括使用`find`结合`column`美化输出、利用`locate`和`mlocate`快速查找、编写Shell脚本自动化任务、使用现代工具`fd`以及结合`grep`和`rg`进行内容搜索。此外,还推荐了几款图形界面搜索工具。掌握这些技巧,让你的文件查找更加高效便捷。
28 2
|
13天前
|
Linux C++
Linux c/c++文件的基本操作
在Linux环境下使用C/C++进行文件的基本操作,包括文件的创建、写入、读取、关闭以及文件描述符的定位。
13 0
Linux c/c++文件的基本操作
|
16天前
|
安全 NoSQL Ubuntu
linux 添加用户useradd 段错误 (核心已转储)
在Linux系统中使用`useradd`命令添加用户时遇到“段错误 (核心已转储)”的问题,通常表明存在系统级或关键组件问题。可通过检查系统日志(如`/var/log/syslog`)和内核消息来定位错误。此外,还需检查并修复文件系统错误(使用`fsck`),确保关键配置文件未损坏,并更新系统包与安全补丁。使用内存检测工具(如memtest86+)排查硬件故障,或重新安装`useradd`及其依赖库。通过`strace`跟踪命令执行过程,检查SELinux/AppArmor安全策略影响,并分析核心转储文件以进一步诊断问题根源。
61 1
|
18天前
|
移动开发 Linux
Linux 文件与目录管理
Linux 文件与目录管理
17 3
|
18天前
|
关系型数据库 MySQL Linux
Linux 文件基本属性
Linux 文件基本属性
15 3
|
13天前
|
Linux C++
Linux c/c++文件虚拟内存映射
这篇文章介绍了在Linux环境下,如何使用虚拟内存映射技术来提高文件读写的速度,并通过C/C++代码示例展示了文件映射的整个流程。
30 0
|
13天前
|
Linux C++
Linux c/c++文件移动
这篇文章介绍了在Linux环境下,使用C/C++语言通过命令方式和文件操作方式实现文件移动的方法。
43 0