SELinux(Security-Enhanced Linux)有以下三种工作模式,每种模式对应不同的安全策略执行强度:
查看当前模式:
getenforce
# 或检查配置文件
sestatus
临时切换模式(重启后失效):
setenforce 1 # 切换到Enforcing
setenforce 0 # 切换到Permissive
永久修改模式:
编辑 /etc/selinux/config,修改 SELINUX= 值为 enforcing、permissive 或 disabled,然后重启系统。
Enforcing。Permissive,避免直接禁用。Disabled 仅作为最后手段,可能引发后续权限问题。