selinux中Enforcing, Permissive 和Disable这三种模式的区别


1、如果要马上拒绝运行SELinux:
[root@localhost ~]# setenforce 0

[root@localhost ~]# getenforce

Permissive
这条命令会把SELinux设定成Permissive模式,其中setenforce 1会把SELinux设定成Enforcing模式

2.把SELinux永久设定为Permissive模式
这里需要讲一下Permissive和Enforcing模式的区别:

SELinux有三种模式:Enforcing, Permissive 和 Disable,Enforcing模式就是应用SELinux所设定的Policy,所有违反Policy的规则(Rules)都会被SELinux拒绝,Permissive和Enforcing的区别就在于,前者还是会遵循SELinux的Policy,但是对于违反规则的操作只会予以记录而并不会拒绝操作,Disable 顾名思义就是完全禁用SELinux;


如果要永久设定为Permissive模式,我们就要修改SELinux的配置文件
/etc/sysconfig/selinux (在RHEL5下这是一个symbolic link to /etc/selinux/conf)
# 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
SELINUX=permissive
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

注意更改完配置文件后需要重启才能生效

查看当前selinux的状态:

/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态
————————————————
版权声明:本文为CSDN博主「穿羊羔绒的007」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_40991510/article/details/89313216

原文地址:https://www.cnblogs.com/lcword/p/15193939.html