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