SELinux 不会在 CentOS7 上禁用

gue*_*php 1 linux selinux centos7

我想在短期内永久禁用,但似乎对我没有任何作用

我试过的步骤

[root@db1e secure]# setenforce 0
[root@db1e secure]# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          disabled
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28
Run Code Online (Sandbox Code Playgroud)

更改 /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 three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 
Run Code Online (Sandbox Code Playgroud)

然后重启httpd服务

两者仍然导致相同的状态,而不是我所期望的禁用状态..有什么想法吗?

小智 9

编辑文件后,要使/etc/sysconfig/selinux更改生效,您需要重新启动系统以完全禁用 SELinux。您可以setenforce 0让系统进入“许可”模式,直到重新启动。

确保您更改SELinux=enforcingSELinux=disabled