一、系统安全加固
1.系统账号清理
1.将非登录用户shell设为/sbin/nologin


2.锁定长期不使用的账号

3.删除无用的账号

4.锁定账号文件passwd、shadow


2.密码安全控制
1.设置密码有效期
2.要求用户下次登录时修改密码


====================设置密码练习===================================
3.命令历史限制
1.减少记录的命令条数
2.注销时自动清空命令历史
3.系统默认保存1000条历史命令记录
4.history -c 命令只可以临时清除记录,重启后记录还在
====================命令历史限制练习===================================
1.修改系统默认的历史条数

2.退出当前终端将命令清楚

4.终端自动注销

二、limits 限制资源
1.ulimit 临时修改


2.永久修改limit限制 vim /etc/security/limits.conf


三、sudo
1.su:切换用户
su username:非登录式切换,即不会读取目标用户的配置文件,不改变当前工作目录,即不完全切换
su - username:登录式切换,会读取目标用户的配置文件,切换至自已的家目录,即完全切换
2.密码验证


注意:su 切换新用户后,使用 exit 退回至旧的用户身份,而不要再用 su 切换至旧用户,否则会生成很多的bash子进程,环境可能会混乱。
3.sudo 提权操作
---通过sudo,让普通用户有超级管理员的某些命令权限

配置sudo授权(两种方式)




四、PAM安全认证
