用户清理
useradd test //新建用户passwd test //更改密码cat /etc/passwd //查看用户列表userdel test //删除用户passwd -l test //禁用用户
修改SSH
vim /etc/ssh/sshd_config //编辑sshd配置文件,修改配置文件中的选项:PermitRootLogin no //禁止root远程ssh登录修改默认端口:Port 2222 //默认22设置协议版本:Protocol 2修改允许密码错误次数:MaxAuthTries 3 //默认6次systemctl restart sshd //重启ssh服务
口令安全策略
vim /etc/login.defs
修改login.defs
PASS_MAX_DAYS 90
PASS_MIN_DAYS 30
PASS_MIN_LEN 9
PASS_WARN_AGE 7 (口令过期前7天开始提示)
vim /etc/pam.d/common-auth
在配置文件中添加 auth required pam_tally.so onerr=fail deny=3 unlock_time=300
设置连续输错3次密码,账号锁定5分钟。
关闭不必要的服务
chkconfig --listchkconfig ip6tables off
修改控制台连接超时时间
vim /etc/profile在末尾加上TMOUT=180 //修改超时时间为180秒source /etc/profile //刷新profile
