2、设置普通用户密码各个时间:
[root@52lab~]#chage-m1-M90-W5-I3-E2014-03-15 bob
-m密码最短有效时间
-M最长
-W:警告waring
-I:不活跃时间inactive
-E:失效时间expire
设置普通用户下一次登陆必须改密码
[root@localhost~]#chage-d0alice
3、帐号锁定操作
[root@52lab~]#passwd-l test [root@52lab~]#passwd-S test [root@52lab~]#passwd-u test [root@52lab~]#usermod-L test [root@52lab~]#usermod-U test -l:锁定、-u解锁、-S查看状态、
-L:usermod下的锁定;
U:usermod的解锁
4、tty终端控制
配置文件/etc/sysconfig/init
ACTIVE_CONSOLES=/dev/tty[1-6]//默认允许使用1-6个tty终端
立即禁止普通用户登录
#touch/etc/nologin
默认是没有这个文件的,创建一个空文件之后,普通用户是无法登陆的,只允许root从指定的几个终端登录
配置文件/etc/securetty
5、伪装终端登陆提示,防止系统版本信息泄漏#vim/etc/issue//本地登陆提示信息
/etc///网络登陆提示信息,如telnet
效果图
6、禁止Ctrl+Alt+Del重启
配置文件:/etc/init/control-alt-delete.conf
[root@52lab~]#vim/etc/init/control-alt-delete.conf #start on control-alt-delete//注释掉此行即可
exec/sbin/shutdown-r now....
7、GRUB引导控制
引导设密的作用:
--限制修改启动参数
--限制进入系统
密码设置方法:
--passwd--md5加密的密码串
--或者,passwd明文密码串
[root@52lab~]#grub-md5-crypt//生成MD5加密的密码串
[root@52lab~]#vim/boot/grub/grub.conf
default=0
timeout=3
password--md5$1$tt3gH1$8nZtL70J/Gv/dAaUm/1
title Red Hat Enterprise Linux(2.6.32-358.el6.x86_64) root(hd0,0)
kernel/vmlinuz-2.6.32-358.el6.x86_64....
initrd/initramfs-2.6.32-358.el6.x86_64.img
8、初始化操作系统
#touch/.unconfigured#重启之后系统会要求你重新修改密码,配置ip地址
#reboot
#重启之后/.unconfigured文件会消失
#chkconfig NetworkManager off
9.利用pam机制:
例一:只有wheel组的成员才可以切换成root用户
#vim/etc/pam.d/su->打开auth required这行的注释
以test身份登陆,执行su–操作,即使输入正确的root密码,也不能登陆
#usermod-aG wheel test->把tom加入到wheel组
再次执行su–操作,tom可以切换成root用户
例二:禁止test从tty2登陆
#vim/etc/pam.d/login,加入下面一行
accont required pam_access.so
#vim/etc/security/access.conf,尾部增加-:tom:tty2
例三:只允许test用户打开两个文件
查看/etc/pam.d/system-auth中包含session required pam_limits.so
#vim/etc/security/limits.conf,尾部增加
tom hard nofile2
不管是切换成为tom,还是以tom身份登陆,都被禁止。