Centos6.x 设置终端超时, 加强用户密码策略

本文介绍了如何通过配置Linux系统来加强安全性,包括设置密码的有效期、最小长度及复杂度要求,调整终端自动注销时间等措施。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 密码有效期, 密码长度

$ more /etc/login.defs

# 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    90
PASS_MIN_DAYS    7
PASS_MIN_LEN    8
PASS_WARN_AGE    7

2. 终端超时时间5分钟

$ cd /etc/profile.d/
$ sudo touch autologout.sh
$ sudo touch autologout.csh

----- autologout.sh ---
#auto out in 5 minutes  
TMOUT=300
readonly TMOUT
export TMOUT


----- autologout.csh ---
#auto out in 5 minutes  
set -r autologout 5

3. 密码复杂度

修改 /etc/pam.d/system-auth 文件, 网上搜到的那些修改 /etc/pam.d/password-auth 文件的都是错的!

#修改这行 (dcredit数字, ucredit大写, lcredit小写, ocredit符号)
password requisite pam_cracklib.so try_first_pass retry=3 type= dcredit=-2 ucredit=-2 lcredit=-2 ocredit=-2
#或者 (minclass 大小写数字字符至少包含3种)
password requisite pam_cracklib.so try_first_pass retry=3 type= minclass=3

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值