首页 > 编程知识 正文

linux关闭selinux命令,selinux开启后性能下降

时间:2023-05-06 21:21:28 阅读:225331 作者:3301

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即为开启状态

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。