1 设置密码复杂度,帐号密码有效期3个月
密码复杂度要求:最小长度8位,至少2位大写字母,1位小写字母,4位数字,1位特殊字符
1)执行备份:
#cp -p /etc/login.defs /etc/login.defs_bak
#cp /etc/pam.d/system-auth /etc/pam.d/system-auth.bak
2)修改策略设置:
(1)密码有效期:
#vi /etc/login.defs
修改PASS_MIN_LEN的值为8
修改PASS_MAX_DAYS的值为90
保存退出
(2)密码复杂度
#vi /etc/pam.d/system-auth
将文件中的下面两行:
password requisite pam_cracklib.so try_first_pass retry=3 type=
password sufficient pam_unix.so sha512 shadow nullok try_first_pass use_authtok
改为:
password requisite pam_cracklib.so try_first_pass retry=5 type= minlen=8 ucredit=-2 lcredit=-1 dcredit=-4 ocredit=-1
password sufficient pam_unix.so md5 shadow nullok try_first_pass use_authtok
- retry=5 定义登录/修改密码失败时,可以重试的次数;
- type=xxx 当添加/修改密码时,系统给出的缺省提示符是什么,用来修改缺省的密码提示文本。默认是不修改的,如上例。
- minlen=8 定义用户密码的最小长度为8位
- ucredit=-2 定义用户密码中最少有2个大写字母 (数字为负数,表示至少有多少个大写字母;数字为正数,表示至多有多少个大写字母;下面同理)
- lcredit=-1 定义用户密码中最少有1个小写字母
- dcredit=-4 定义用户密码中最少有4个数字
- ocredit=-1 定义用户密码中最少有1个特殊字符(除数字、字母之外)
2 登录失败5次锁定帐号5分钟
1)备份
#cp /etc/pam.d/system-auth /etc/pam.d/system-auth.bak2
#cp /etc/pam.d/sshd /etc/pam.d/sshd.bak
2)修改
#vi /etc/pam.d/system-auth
auth required p