​1、设置密码过期的天数。 用户必须在几天内更改密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令“chage -M(days)(user)”

[root@shaonbean ~]# vi /etc/login.defs
# line 25: set 60 for Password Expiration
PASS_MAX_DAYS 60

2、设置可用密码的最短天数。 至少在改变它之后,用户必须至少使用他们的密码。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为现有用户,请运行命令“chage -m(days)(user)”

[root@shaonbean ~]# vi /etc/login.defs
# line 26: set 2 for Minimum number of days available
PASS_MIN_DAYS 2

3、在到期前设置警告的天数。 此设置仅在创建用户时才会产生影响,而不会影响到现有用户。 如果设置为存在用户,请运行命令“chage -W(days)(user)”

[root@shaonbean ~]# vi /etc/login.defs
# line 28: set 7 for number of days for warnings
PASS_WARN_AGE 7

4、使用过去使用的密码进行限制。 在这一代中,用户不能设置相同的密码。

[root@shaonbean ~]# vi /etc/pam.d/system-auth
# near line 15: prohibit to use the same password for 5 generation in past
password     sufficient     pam_unix.so sha512 shadow nullok try_first_pass use_authtok remember=5

5、设置最小密码长度。 用户不能将密码长度设置为小于此参数。

# set 8 for minimum password length
[root@shaonbean ~]# authconfig --passminlen=8 --update
# the parameter is set in a config below
[root@shaonbean ~]# grep "^minlen" /etc/security/pwquality.conf
minlen = 8

6、为新密码设置所需的最少字符类数。 (种类⇒UpperCase / LowerCase / Digits / Others)

# set 2 for minimum number of required classes of characters
[root@shaonbean ~]# authconfig --passminclass=2 --update
# the parameter is set in a config below
[root@shaonbean ~]# grep "^minclass" /etc/security/pwquality.conf
minclass = 2

7、在新密码中设置允许的连续相同字符的最大数量。

# set 2 for maximum number of allowed consecutive same characters
[root@shaonbean ~]# authconfig --passmaxrepeat=2 --update
# the parameter is set in a config below
[root@shaonbean ~]# grep "^maxrepeat" /etc/security/pwquality.conf
maxrepeat = 2

8、在新密码中设置同一类的最大允许连续字符数。


# set 4 for maximum number of allowed consecutive characters of the same class
[root@shaonbean ~]# authconfig --passmaxclassrepeat=4 --update
# the parameter is set in a config below
[root@shaonbean ~]# grep "^maxclassrepeat" /etc/security/pwquality.conf
maxclassrepeat = 4

9、新密码中至少需要一个小写字符

[root@shaonbean ~]# authconfig --enablereqlower --update
# the parameter is set in a config below
# (if you'd like to edit the value, edit it with vi and others)
[root@shaonbean ~]# grep "^lcredit" /etc/security/pwquality.conf
lcredit = -1

10、新密码中至少需要一个大写字符

[root@shaonbean ~]# authconfig --enablerequpper --update
# the parameter is set in a config below
# (if you'd like to edit the value, edit it with vi and others)
[root@shaonbean ~]# grep "^ucredit" /etc/security/pwquality.conf
ucredit = -1

11、新密码中至少需要一位数字

[root@shaonbean ~]# authconfig --enablereqdigit --update
# the parameter is set in a config below
# (if you'd like to edit the value, edit it with vi and others)
[root@shaonbean ~]# grep "^dcredit" /etc/security/pwquality.conf
dcredit = -1

12、新密码中至少需要一个其他字符

[root@shaonbean ~]# authconfig --enablereqother --update
# the parameter is set in a config below
# (if you'd like to edit the value, edit it with vi and others)
[root@shaonbean ~]# grep "^ocredit" /etc/security/pwquality.conf
ocredit = -1

13、在新密码中设置单调字符序列的最大长度。 (ex⇒’12345’,’fedcb’)

[root@shaonbean ~]# vi /etc/security/pwquality.conf
# add to the end
maxsequence = 3

14、设置旧密码中不能出现的新密码中的字符数。

[root@shaonbean ~]# vi /etc/security/pwquality.conf
# add to the end
difok = 5

15、检查新密码中是否包含用户passwd项的GECOS字段中长度超过3个字符的单词

[root@shaonbean ~]# vi /etc/security/pwquality.conf
# add to the end
gecoscheck = 1

16、设置不能包含在密码中的Ssace分隔列表。


[root@shaonbean ~]# vi /etc/security/pwquality.conf
# add to the end
badwords = denywords1 denywords2 denywords3

17、为新密码设置散列/密码算法。 (默认是sha512)

# show current algorithm
[root@shaonbean ~]# authconfig --test | grep hashing
password hashing algorithm is md5
# chnage algorithm to sha512
[root@shaonbean ~]# authconfig --passalgo=sha512 --update
[root@shaonbean ~]# authconfig --test | grep hashing
password hashing algorithm is sha512

CentOS7 设置用户密码规则相关推荐

  1. 【转载】SAP用户密码规则限制-安全策略

    SAP用户密码规则限制-安全策略 有些公司因为安全方面的考虑会限制一些密码的规则,例如密码长度最短不能小于10位:必须包含大写字母.小写字母和数字以及特殊符号等.这样虽然安全强度提高了,但是对于我这种 ...

  2. linux设置用户密码、查看linux用户信息、root用户管理普通用户(passwd命令使用)

    1 切换root用户和给root用户设置密码 1.1 切换到root用户 1.使用su 命令 或 su root命令切换到root用户的时候报错:su: Authentication failure ...

  3. Kubernetes Dashboard 设置用户密码登陆

    Kubernetes Dashboard 设置用户密码登陆 Kubernetes 2019年05月20日 K8s 文档 K8s 1.13源码安装 k8s dashboard token访问 仪表板是基 ...

  4. Linux命令之设置用户密码passwd

    概述 passwd 命令可以设置用户密码.通过 useradd 命令创建的用户初始是没有密码的,需要通过 passwd 命令来为其设置密码,未设置密码的用户不能登录系统. 注:超级用户可以为自己和其他 ...

  5. oracle设置用户密码永不过期

    oracle设置用户密码永不过期 转载:原文链接https://blog.csdn.net/chenqi3166/article/details/125141774 转载:原文链接https://bl ...

  6. Linux常用命令(中)、时间日期类、date 显示当前时间、ntpdate命令、cal 查看日历、useradd 添加新用户、passwd 设置用户密码、id 查看用户是否存在

    文章目录 1.3 时间日期类 1.3.1 date 显示当前时间 1.3.2 date 显示非当前时间 1.3.3 date 设置系统时间 1.3.4ntpdate命令 ntpdate常用服务器 国内 ...

  7. Linux系统设置用户密码规则(复杂密码策略)方法

    1. 设备用户密码的有效期(默认情况下,用户的密码永不过期) 编辑login.defs vim /etc/login.defs 说明: Password aging controls: PASS_MA ...

  8. linux创建永不过期用户,linux下如何设置用户密码永不过期_网站服务器运行维护...

    linux中有几种文件类型_网站服务器运行维护 linux中可分为6种文件类型,分别是:1.普通文件(数据文件):2.目录文件:3.设备文件:4.链接文件:5.管道文件:6.套接字文件,用于不同计算机 ...

  9. oracle用户密码规则,使用Oracle自带profile以及函数简单设定Oracle用户名密码规则...

    使用Oracle自带profile以及函数设定密码规则 $ sqlplus / as sysdba SQL > (select PROFILE from dba_users where user ...

最新文章

  1. 我用24小时、8块GPU、400美元在云上完成训练BERT!
  2. Python staticmethod() 函数
  3. chm帮助文档出现乱码
  4. 【下班后学Android】Android开发环境搭建
  5. WebForm-博客园-1.0-账户模块(Passport)-登录与注册
  6. python安装过程中出现文件或目录损坏且无法读取_解决安装python库时windows error5 报错的问题...
  7. 二维数组作为形参的参数传递问题[08-0704]-转
  8. fedora yum无法正常运行问题的解决
  9. upper_bound( )和lower_bound()的用法
  10. Java String子序列
  11. php管理系统模板,自定义模块后台模板
  12. 首度亮相服贸会,亚马逊云科技如何演绎“大象起舞”?
  13. ios 上h5点击无效_ios h5 点击事件失效及点击延迟
  14. echarts 实现温度计
  15. Oracle greatest函数
  16. MacBook软件安装和更新与卸载
  17. git push -u origin XXX 报错
  18. 网络安全_密码学实验_对称加密算法DES
  19. 【OpenCV入门教程】图像加噪
  20. tof 相机的数据读取,depth data和amplitude data以及3D数据

热门文章

  1. 嵌入式驱动程序之信号量
  2. Spring Boot 添加拦截器的配置方式
  3. 2019年宁夏文化科技卫生“三下乡”集中示范活动启动
  4. 使用userdel命令删除Linux用户
  5. 6、SpringBoot+Mybatis整合------参数传递
  6. 2018.03.03、android-照虎画猫搭建简易Rest服务器
  7. 常用HiveQL总结
  8. Spring配置问题——元素 quot;context:component-scanquot; 的前缀 quot;contextquot; 未绑定...
  9. 常见的浏览器兼容问题
  10. 【POJ】1505 Copying Books