linux帐号管理篇

useradd 添加用户 
passwd 添加密码
使用useradd 创建一个用户时会参考的文件:


/etc/default/useradd
/etc/login.defs
/etc/skel/*




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


# 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  500
UID_MAX 60000


#
# Min/max values for automatic gid selection in groupadd
#
GID_MIN  500
GID_MAX 60000


#
# 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                 ##创建文件是默认添加家目录


# The permission mask is initialized to this value. If not specified, 
# the permission mask will be initialized to 022.
UMASK           077


# This enables userdel to remove user groups if no members exist.
#
USERGROUPS_ENAB yes      ##使用userdel 删除时是否删除初始组     


# Use SHA512 to encrypt password.
ENCRYPT_METHOD SHA512           ##加密方式












passwd: 
-l:锁定用户(实质是在/etc/shadow 密码前加入感叹号)
-s:查看密码参数

chage:
-l:列出该用户的详细密码参数
-d:修改/etc/shadow下最近一次的修改密码日期  YYYY-MM-DD
-E:后面接日期,修改帐号的失效日期 YYYY-MM-DD
-I:密码失效日期  加 天数
-m:密码保留的天数
-M:密码多久需要更改
-W:密码过期前的警告日期


usermod 轻微修改
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值