Linux command
setenforce 命令
文本
Copy it and replace filenames, paths, or keywords as needed.
命令示例
Put
setenforce 1
Put
setenforce 0
说明
setenforce toggles SELinux between enforcing and permissive modes at runtime. In enforcing mode, SELinux denies access based on policy rules. In permissive mode, violations are logged but not blocked. This change is temporary and does not persist across reboots. To permanently change the SELinux mode, edit /etc/selinux/config and set the SELINUX variable.
参数
- 0, Permissive
- Switch to permissive mode (log violations but don't enforce)
- 1, Enforcing
- Switch to enforcing mode (log and enforce policy)
FAQ
What is the setenforce command used for?
setenforce toggles SELinux between enforcing and permissive modes at runtime. In enforcing mode, SELinux denies access based on policy rules. In permissive mode, violations are logged but not blocked. This change is temporary and does not persist across reboots. To permanently change the SELinux mode, edit /etc/selinux/config and set the SELINUX variable.
How do I run a basic setenforce example?
Run `setenforce 1` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does 0, Permissive do in setenforce?
Switch to permissive mode (log violations but don't enforce)