selinux有三种模式,配置文件位于:/etc/sysconfig/selinux
# 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 three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
enforcing:强制模式
permissive:警告模式
disabled:关闭selinux
永久修改selinux模式在上述配置文件中修改,然后需要重启服务器。
临时修改setenforce 0 (临时修改为警告模式,服务器重启后失效)
setenforce 1(临时修改为强制模式,服务器重启后失效)
getenforce:查看当前模式