#安全加固脚本 #!/bin/bash #version1.0;write at 2017-03-29; #write by Ringoo; #1.将root管理员名称修改为Ringoo useradd -u 0 -g 0 -o ringoo useradd pso #2.修改默认密码策略 #备份文件 cp /etc/login.defs /etc/login.defs.bak sed -i 's/99999/90/' /etc/login.defs #3.设置3次输错密码锁定用户 #备份文件 cp /etc/pam.d/system-auth /etc/pam.d/system-auth.bak sed -e '5 i\auth required /lib64/security/pam_tally2.so deny=3 unlock_time=300' -i /etc/pam.d/system-auth #密码复杂度设置 sed -e "14 i\password requisite pam_cracklib.so minlen=10 difok=3 lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1 try_first_pass retry=3" -i /etc/pam.d/system-auth sed -e '15d' -i /etc/pam.d/system-auth #修改/etc/profile #备份文件 cp /etc/profile /etc/profile.bak sed -e 's/HISTSIZE=1000/HISTSIZE=3000/' -i /etc/profile sed -i "/HISTSIZE=3000/a HISTTIMEFORMAT=\"%F %T \"" /etc/profile
【Linux】Linux安全加固脚本
最新推荐文章于 2024-04-30 17:22:36 发布