那么Linux是如何实现对用户的密码的复杂度的检查的呢?其实系统对密码的控制是有两部分组成:

1 cracklib

2 /etc/login.defs

pam_cracklib.so 才是控制密码复杂度的关键文件/lib/security/pam_cracklib.so, Redhat公司专门开发了cracklib这个安装包来判断密码的复杂度。如果你想查看pam_cracklib的一些参数,那么就使用下面命令

[root@DB-Server security]# man pam_cracklib

其中一些常见的参数为
 
retry=N
改变输入密码的次数,默认值是1。就是说,如果用户输入的密码强度不够就退出。可以使用这个选项设置输入的次数,以免一切都从头再来 Prompt user at most N times before returning with error. The
default is minlen=N
新密码最低可接受的长度 The minimum acceptable size for the new password (plus one if
credits are not disabled which is the default). In addition to the
number of characters in the new password, credit (of + in length)
is given for each different kind of character (other, upper, lower
and digit). The default for this parameter is which is good for a
old style UNIX password all of the same type of character but may
be too low to exploit the added security of a md5 system. Note that
there is a pair of length limits in Cracklib itself, a "way too
short" limit of 4 which is hard coded in and a defined limit (6)
that will be checked without reference to minlen. If you want to
allow passwords as short as characters you should not use this
module. difok=N
默认值为10。这个参数设置允许的新、旧密码相同字符的个数。不过,如果新密码中1/2的字符和旧密码不同,则新密码被接受 This argument will change the default of for the number of
characters in the new password that must not be present in the old
password. In addition, if / of the characters in the new password
are different then the new password will be accepted anyway. dcredit=N
限制新密码中至少有多少个数字 (N >= ) This is the maximum credit for having digits in the new
password. If you have less than or N digits, each digit will count
+ towards meeting the current minlen value. The default for
dcredit is which is the recommended value for minlen less than
. (N < ) This is the minimum number of digits that must be met for a
new password. ucredit=N
限制新密码中至少有多少个大写字符。 lcredit=N
限制新密码中至少有多少个小写字符。

例如在/etc/pam.d/system-auth 在password使用pam_cracklib.so设置的最后附加dcredit=3 ucredit=2

password    requisite     pam_cracklib.so try_first_pass retry=3 dcredit=3 ucredit=2
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok
password    required      pam_deny.so

此时如果你新建用户的密码不符合密码复杂度,就会出现BAD PASSWORD: it is based on a dictionary word提示。

[root@DB-Server ~]# passwd ttt
Changing password for user ttt.
New UNIX password: 
BAD PASSWORD: it is based on a dictionary word

转自

Linux账户密码过期安全策略设置 - 潇湘隐者 - 博客园
http://www.cnblogs.com/kerrycode/p/5600525.html

Linux是对用户的密码的复杂度要求设置【转】的更多相关文章

  1. Linux系统root用户忘记密码解决方法

    一:在linux系统启动时(如下图),按e键 二:进入到设置页面,定位到如下行: 三:按e键,进入输入界面 四:在编辑行最后面,空格,输入single,回车后回到第二步界面,只是后面多了single ...

  2. 【Hadoop系列】linux下 root用户免密码登录远程主机 ssh

    SSH原理:[Hadoop系列]linux SSH原理解析 操作环境: CentOS 6.5 操作对象: 用户A主机和远程主机B 正文部分:斜体加粗代表linux指令. linux下 非root用户免 ...

  3. linux中普通用户修改密码出现(passwd:Authentication token manipulation error)

    如果在linux中,不管是root用户还是普通用户登录后,修改自己的密码,出现---passwd:Authentication token manipulation error---错误的解决办法: ...

  4. Linux忘记root用户的密码

    问题: 由于长时间没有操作过自己安装的虚拟机,导致连root用户的密码都忘了,也真是没谁了. 我使用的是centos6.5,今天就记录一下,如何重置root用户的密码. 操作步骤: 步骤一: 当开机启 ...

  5. linux修改root用户登陆密码

    如果不是以root用户登录的,请先切换到root用户下, 执行命令:su root 然后按提示输入root用户的密码. 英文系统: [root@localhost ~]# passwd Changin ...

  6. linux系统root用户忘记密码的重置方法

    如果不小心忘记了新安装的lCentOS7的root密码,现在将找回过程分享给大家. 1.首先,在启动grub菜单,选择编辑选项启动: 2.然后,按e 进入编辑模式: 3.将'linux 16'行'ro ...

  7. linux中ftp用户登录密码忘记了怎么修改

    先来熟悉一下 vsftp 命令: 启动vsftp用命令: 1.service vsftpd start 重启vsftp用: www.111cn.net1.service vsftpd restart ...

  8. linux:如何修改用户的密码

    1.首先,要用CRT软件连接Linux系统. 2.首选,确认是用root用户登录系统的. 输入命令: id ,查看登录用户信息. 3.若修改root自己的密码,直接输入 passwd . 输入两遍,新 ...

  9. 2、Linux系统root用户忘记密码的重置方式

    .界面按空格暂停,按E .找到UTF-,在后面空格后输入init=/bin/sh 然后CHRL+X启动 .进入到这个界面,输入mount -o remount,rw / .输入passwd..然后输入 ...

随机推荐

  1. luogu 1437 敲砖块(DP)

    这道题的DP的状态设计的很有想法啊. 假如我们一行一行来选择的话,状态将会极其复杂. 如果一列一列来看的话,比如你想选aij,那么第i列的前j个都要选,并且第i+1列的前j-1个都要选. 于是状态就很 ...

  2. P3984 高兴的津津

    题目描述 津津上高中了.她在自己的妈妈的魔鬼训练下,成为了一个神犇,每次参加一次OI比赛必拿Au虐全场.每次她拿到一个Au后就很高兴.假设津津不会因为其它事高兴,并且她的高兴会持续T天(包包含获奖当天 ...

  3. [NOI2011]兔兔与蛋蛋游戏 二分图博弈

    题面 题面 题解 通过观察,我们可以发现如下性质: 可以看做是2个人在不断移动空格,只是2个人能移动的边不同 一个位置不会被重复经过 : 根据题目要求,因为是按黑白轮流走,所以不可能重复经过一个点,不 ...

  4. YOLO v1之总结篇(linux+windows)

    YOLO出自2016 CVPR You Only Look Once:Unified, Real-Time Object Detection,也是一个非常值得学习的框架,不得不说facebook的技术 ...

  5. CVE-2017-16995 Ubuntu16.04本地提权漏洞复现

    0x01 前言 该漏洞由Google project zero发现.据悉,该漏洞存在于带有 eBPF bpf(2)系统(CONFIG_BPF_SYSCALL)编译支持的Linux内核中,是一个内存任意 ...

  6. poj1486 Sorting Slides

    Sorting Slides Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 4812   Accepted: 1882 De ...

  7. laravel 5.5 在构造函数使用Session

    public function __construct() { $this->request = request(); // 验证是否登录 $this->middleware(functi ...

  8. Vue.js和angular.js区别

    Vue.js:易学 简单 指令以v.xxx 一片HTML代码配合json,在new出来Vue,js实例 个人维护项目 适用于移动端 应用超越了angular angular.js:上手难 指令以ng. ...

  9. 数学:A^B的约数(因子)之和对MOD取模

    POJ1845 首先把A写成唯一分解定理的形式 分解时让A对所有质数从小到大取模就好了 然后就有:A = p1^k1 * p2^k2 * p3^k3 *...* pn^kn 然后有: A^B = p1 ...

  10. select表单元素详解及下拉列表模拟实现

    原文地址:→看过来 写在前面 select 是HTML表单元素中很常用的一个,其中很重要的几个属性常被忽略,但这几个属性却能帮助我们完成很多的功能,当然,select下拉列表默认样式很不友好,所以更多 ...