码迷,mamicode.com
首页 > 系统相关 > 详细

selinux详解

时间:2017-04-05 00:09:07      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:selinux;linux

查看selinux配置文件

[root@localhost ~]# cat  /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=enforcing

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

修改selinux为关闭状态


方法一

[root@localhost ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled 

# SELINUXTYPE= can take one of these two values:

#     targeted - Targeted processes are protected,

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

在vi下按“i”进行编辑,讲enforcing改为disabled

按“esc”退出编辑模式,“:wq ” 保存退出



检查:cat /etc/selinux/config



方法二

设置:sed -i s#SELINUX=enforcing#SElINUX=disabled#g /etc/selinux/config

检查:grep "disable" /etc/selinux/config


以上永久关闭selinux,重启生效




查看selinux状态:

[root@localhost ~]# getenforce 

Enforcing

临时关

[root@localhost ~]# setenforce 0

[root@localhost ~]# getenforce 

Permissive

即时生效



selinux详解

标签:selinux;linux

原文地址:http://zzzhbr.blog.51cto.com/6480548/1912812

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!