您的位置:首页 > 运维架构 > Linux

【linux系统优化】Selinux介绍及关闭方法

2015-06-03 09:45 519 查看

Selinux:SELinux(Security-EnhancedLinux) 是美国国家安全局(NSA)对于强制访问控制的实现,是 Linux历史上最杰出的新安全子系统。虽然是一个安全功能,可是由于功能太多了,什么都要管,所以用起来反而更麻烦,因而可以把它关闭,进而使用其它的安全方式替代。

【1】查看Selinux运行的3种模式

[code=as3;toolbar:false">[root@moban ~]#cat /etc/selinux/config     #此为Selinux的配置文件目录 # This filecontrols the state of SELinux on the system. # SELINUX= cantake one of these three values: #     enforcing - SELinux security policy isenforced. #     permissive - SELinux prints warningsinstead of enforcing. #     disabled - No SELinux policy is loaded. SELINUX=enforcing # SELINUXTYPE=can take one of these two values: #     targeted - Targeted processes areprotected, #     mls - Multi Level Security protection. SELINUXTYPE=targeted

可以看到有3种运行模式:enforcing:开启Selinux permissive:自由模式,此种模式下,只会打印警告消息,但不会阻止 disabled:关闭Selinux【2】更改Selinux配置文件的运行模式

方法一:使用vi文件编辑器修改[root@moban ~]# vi /etc/selinux/config将“SELINUX=enforcing”修改为“SELINUX=disabled”,保存退出即可

方法二:sed命令[root@moban ~]#sed -i s#SELINUX=enforcing#SELINUX=disabled#g /etc/selinux/conf [root@moban ~]#grep "disabled" /etc/selinux/config #     disabled - No SELinux policy is loaded. SELINUX=disabled注意一定要加参数-i,否则只改变输出,而不是改变配置文件的内容。但是需要注意的是,由于修改Selinux的配置文件需要在下一次重启后才生效,因此当前Selinux实际运行状态仍是enforcing,所以需要再进行一些设置。(为了不重启Linux系统)

[p][strong]
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: