ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

创建用户相关的文件

2020-12-10 14:36:32  阅读:146  来源: 互联网

标签:文件 创建 用户 etc file MAIL tools PAM DIR


/etc/login.defs 文件说明
此文件的作用是预先定义创建用户时需要的一些用户默认配置信息。

[root@testdb62 ~]# cat /etc/login.defs 
#
# Please note that the parameters in this configuration file control the
# behavior of the tools from the shadow-utils component. None of these
# tools uses the PAM mechanism, and the utilities that use PAM (such as the
# passwd command) should therefore be configured elsewhere. Refer to
# /etc/pam.d/system-auth for more information.
#

# *REQUIRED*
#   Directory where mailboxes reside, _or_ name of file, relative to the
#   home directory.  If you _do_ define both, MAIL_DIR takes precedence.
#   QMAIL_DIR is for Qmail
#
#QMAIL_DIR    Maildir
MAIL_DIR    /var/spool/mail
#MAIL_FILE    .mail     #<== 设定用户对应的mail文件所在路径 

# Password aging controls:
#
#    PASS_MAX_DAYS    Maximum number of days a password may be used.
#    PASS_MIN_DAYS    Minimum number of days allowed between password changes.
#    PASS_MIN_LEN    Minimum acceptable password length.
#    PASS_WARN_AGE    Number of days warning given before a password expires.
#
PASS_MAX_DAYS    99999   #<== 密码最长可以使用的天数
PASS_MIN_DAYS    0       #<== 更换密码的最小天数 
PASS_MIN_LEN    5       #<== 密码最小长度 
PASS_WARN_AGE    7       #<== 密码失效之前提前多少天开始警告 

#
# Min/max values for automatic uid selection in useradd
#
UID_MIN                  1000  #<== 默认最小UID为1000,也就是说添加用户时,UID是从1000开始的
UID_MAX                 60000  #<== 默认最大UID为60000
# System accounts
SYS_UID_MIN               201
SYS_UID_MAX               999

#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN                  1000  #<== 默认最小GID为1000,也就是说添加用户时,GID是从1000开始的
GID_MAX                 60000  #<== 默认最大GID为60000
# System accounts
SYS_GID_MIN               201
SYS_GID_MAX               999

#
# If defined, this command is run when removing a user.
# It should remove any at/cron/print jobs etc. owned by
# the user to be removed (passed as the first argument).
#
#USERDEL_CMD    /usr/sbin/userdel_local  #<== 删除用户时,删除与用户相关的所有工作,默认关闭

#
# If useradd should create home directories for users by default
# On RH systems, we do. This option is overridden with the -m flag on
# useradd command line.
#
CREATE_HOME    yes   #<== 是否创建用户家目录,默认要求创建。可以用-m参数进行控制

# The permission mask is initialized to this value. If not specified, 
# the permission mask will be initialized to 022.
UMASK           077  #<== 家目录对应umask默认值

# This enables userdel to remove user groups if no members exist.
#
USERGROUPS_ENAB yes  #<== 删除用户同时删除用户组(如果用户组没有其他成员,则删除)

# Use SHA512 to encrypt password.
ENCRYPT_METHOD SHA512   #<== 密码加密算法



/etc/default/useradd  文件 
此文件的作用是使用useradd添加用户时预先加载的默认用户信息配置文件,可以使用useradd -D 修改此文件的配置

[root@testdb62 ~]# cat /etc/default/useradd 
# useradd defaults file
GROUP=100               #<== 依赖于/etc/login.defs USERGROUPS_ENAB参数,如果为no,则受此处控制。
HOME=/home              #<== 在/home目录下创建用户的家目录。
INACTIVE=-1             #<== 是否启用用户过期停权,-1表示不启用。
EXPIRE=                 #<== 用户终止日期,不设置表示不启用。
SHELL=/bin/bash         #<== 新用户默认使用的shell解释器。
SKEL=/etc/skel          #<== 配置新用户家目录的默认环境变量文件的存放路径。
CREATE_MAIL_SPOOL=yes   #<== 创建mail文件。


/etc/skel  目录下的文件

[root@testdb62 ~]# ls -lA  /etc/skel
总用量 12
-rw-r--r--. 1 root root  18 8月   8 2019 .bash_logout
-rw-r--r--. 1 root root 193 8月   8 2019 .bash_profile
-rw-r--r--. 1 root root 231 8月   8 2019 .bashrc

当使用useradd添加用户时,用户家目录下的隐藏环境变量文件,都是从这里配置的 /etc/skel目录中复制过去的。
默认情况下,/etc/skel 目录下的文件下的所有文件都是隐藏文件。

 

标签:文件,创建,用户,etc,file,MAIL,tools,PAM,DIR
来源: https://www.cnblogs.com/l10n/p/14113902.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有