8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 8 安全 / 8.7 SELinux / 8.7.2 更改 SELinux 模式
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

8.7.2 更改 SELinux 模式8.7.2 Changing the SELinux Mode

SELinux 支持强制(enforcing)、宽容(permissive)和禁用(disabled)模式。强制模式是默认模式。宽容模式允许在强制模式下不被允许的操作,并将这些操作记录到 SELinux 审计日志中。宽容模式通常在开发策略或进行故障排除时使用。在禁用模式下,策略不被执行,系统对象也不会应用上下文,这使得以后启用 SELinux 变得困难。SELinux supports enforcing, permissive, and disabled modes. Enforcing mode is the default. Permissive mode allows operations that are not permitted in enforcing mode and logs those operations to the SELinux audit log. Permissive mode is typically used when developing policies or troubleshooting. In disabled mode, polices are not enforced, and contexts are not applied to system objects, which makes it difficult to enable SELinux later.

要查看当前的 SELinux 模式,请使用前面提到的 sestatus 命令或 getenforce 工具。To view the current SELinux mode, use the sestatus command mentioned previously or the getenforce utility.

$> getenforce
Enforcing

要更改 SELinux 模式,请使用 setenforce 工具:To change the SELinux mode, use the setenforce utility:

$> setenforce 0
$> getenforce
Permissive
$> setenforce 1
$> getenforce
Enforcing

使用 setenforce 所做的更改在重启系统后会丢失。要永久更改 SELinux 模式,请编辑 /etc/selinux/config 文件并重启系统。Changes made with setenforce are lost when you restart the system. To permanently change the SELinux mode, edit the /etc/selinux/config file and restart the system.