Linux运维知识之15、login.defs(默认)登录和Linux默认权限设置(密码复杂度,相关安全设置)
小标 2018-11-07 来源 : 阅读 2103 评论 0

摘要:本文主要向大家介绍了Linux运维知识之15、login.defs(默认)登录和Linux默认权限设置(密码复杂度,相关安全设置),通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

本文主要向大家介绍了Linux运维知识之15、login.defs(默认)登录和Linux默认权限设置(密码复杂度,相关安全设置),通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助。

[root@www ~]# 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      MaildirMAIL_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   99999PASS_MIN_DAYS   0PASS_MIN_LEN    5PASS_WARN_AGE   7
#
Min/max values for automatic uid selection in useradd
#UID_MIN                   500UID_MAX                 60000
#
Min/max values for automatic gid selection in groupadd
#GID_MIN                   500GID_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
Use SHA512 to encrypt password.
ENCRYPT_METHOD SHA512 
在linux,设置密码复杂度的方法有几个


一个是在/etc/login.defs文件,里面几个选项PASS_MAX_DAYS 90 #密码最长过期天数PASS_MIN_DAYS 80 #密码最小过期天数PASS_MIN_LEN 10 #密码最小长度PASS_WARN_AGE 7 #密码过期警告天数

另外一个方法是,修改/etc/pam.d/system-auth文件找到 password requisite pam_cracklib.so这么一行替换成如下:password requisite pam_cracklib.so retry=5 difok=3 minlen=10 ucredit=-1 lcredit=-3 dcredit=-3 dictpath=/usr/share/cracklib/pw_dict不需要在pw_dict后面加.pwd,因为默认会带的[root@front4 ~]# passwd testChanging password for user test.New password: /usr/share/cracklib/pw_dict.pwd.pwd: No such file or directory

参数含义:尝试次数:5 最少不同字符:3 最小密码长度:10 最少大写字母:1 最少小写字母:3 最少数字:3 密码字典:/usr/share/cracklib/pw_dict
这样设置好,你可以做一下测试,不过需要先退出root,因为root用户并不会受这些限制,它可以设置任意的密码。
密码复杂性原则:数字,大写,小写,特殊字符实例如下:

本文由职坐标整理并发布,希望对同学们有所帮助。了解更多详情请关注系统运维Linux频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程