CentOS 7.X 關閉SELinux
阿新 • • 發佈:2021-11-03
轉載:https://www.cnblogs.com/activiti/p/7552677.html
1、檢視
[root@dev-server ~]# getenforce
Disabled
[root@dev-server ~]# /usr/sbin/sestatus -v
SELinux status: disabled
2、臨時關閉
##設定SELinux 成為permissive模式
##setenforce 1 設定SELinux 成為enforcing模式
setenforce 0
3、永久關閉
vi /etc/selinux/config
將SELINUX=enforcing改為SELINUX=disabled
設定後需要重啟才能生效
centos 7.0 檢視selinux狀態|關閉|開啟
Linux在安裝好之後通常SELinux都是出於預設開啟的狀態,開啟的情況下會導致一些服務的安裝不成功。
在不需要的情況下完全可以關閉掉,下面是在centos 7.0裡面如何檢視,關閉selinux。
檢視selinux狀態
[root@localhost~] #sestatus
SELinuxstatus:enabled
SELinuxfs mount : /sys/fs/selinux
SELinuxrootdirectory: /etc/selinux
Loadedpolicyname:targeted
Currentmode:enforcing Modefromconfig file :enforcing
PolicyMLSstatus:enabled
Policydeny_unknownstatus:allowed
Maxkernelpolicyversion:28
|
臨時關閉
[root@localhost~] #setenforce0
|
永久關閉
可以修改配置檔案/etc/selinux/config,將其中SELINUX設定為disabled。
[root@localhost~]
#cat/etc/selinux/config
#ThisfilecontrolsthestateofSELinuxonthesystem.
#SELINUX=cantakeoneofthesethreevalues:
#enforcing-SELinuxsecuritypolicyisenforced.
#permissive-SELinuxprintswarningsinsteadofenforcing.
#disabled-NoSELinuxpolicyisloaded.
#SELINUX=enforcing
SELINUX=disabled
#SELINUXTYPE=cantakeoneofthreetwovalues:
#targeted-Targetedprocessesareprotected,
#minimum-Modificationoftargetedpolicy.Onlyselectedprocessesareprotected.
#mls-MultiLevelSecurityprotection.
SELINUXTYPE=targeted
[root@rdo~]
#sestatus
SELinuxstatus:disabled