هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
getenforce prints Enforcing, Permissive or Disabled. setenforce 0 switches to permissive (log only), setenforce 1 back to enforcing. It does not work when SELinux is disabled, and it does not change the boot mode — that is SELINUX= in /etc/selinux/config.
طريقة الكتابة
getenforce
setenforce Enforcing|Permissive|1|0الخيارات 2
الأكثر استخدامًا
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 10
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Show the mode
getenforce EnforcingThe normal state.
2Permissive for a test
setenforce 0 getenforce PermissiveIf the problem is gone now, SELinux was the cause.
3Back to enforcing
setenforce 1Never forget this step.
4Mode at boot
grep ^SELINUX= /etc/selinux/config SELINUX=enforcingChange here for the next boot.
5Test a service quickly
Compare the result with enforcing.
6Better: only one domain permissive
semanage permissive -a httpd_tThe rest of the system stays protected.
7Disabled system
setenforce 1 setenforce: SELinux is disabledNeeds a config change, relabel and reboot.
8In a monitoring check (security)
Attackers often switch SELinux off.
9Check the kernel arguments
grep -o 'selinux=[01]\|enforcing=[01]' /proc/cmdlineselinux=0 disables SELinux; enforcing=0 boots permissive.
10Logged mode changes
ausearch -m MAC_STATUS -ts todayWho changed the mode and when.
لا يوجد شيء يطابق هذا الفلتر.
رموز الخروج
0 :: Done. 1 :: Error (for example SELinux disabled).