Ver el estado de SELinux y cerrar SELinux

1. Verifique el estado de SELinux:

1. Podemos ver el estado viendo el comando cat /etc/selinux/config en el archivo de configuración

[root@lill ~]# cat /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=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

Se encuentra que SELinux tiene tres estados: hacer cumplir (ejecutar), permisivo (no ejecutar pero generar una advertencia) y deshabilitado (cerrar).

2. También puedes consultar con este comando: getenforce

[root@localhost /]# getenforce
Enforcing

3. También puede usar los siguientes comandos, si el parámetro de estado de SELinux está habilitado, está en estado abierto

[root@localhost /]# /usr/sbin/sestatus -v
SELinux status:                 enabled

2. Apague SELinux:

1. Apagado temporal (fallo después de reiniciar la máquina):

#setenforce 0设置为permissive模式;setenforce 1 设置为enforcing模式;
setenforce 0                  

2. Apagado permanente (es necesario reiniciar la máquina):

sed -i s#SELINUX=enforcing#SELINUX=disabled# /etc/selinux/config

Simplemente reinicie la máquina

Supongo que te gusta

Origin blog.csdn.net/hanxiaotongtong/article/details/124208569
Recomendado
Clasificación