الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

getsebool

Show SELinux booleans (getsebool) or switch them on and off (setsebool; with -P permanently).

المستوى
امتحان RHCSA
المجموعة
SELinux والأمان
يحتاج root
للتغييرات
الحزمة
libselinux-utils / policycoreutils
يُسمّى أيضًا
setsebool

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

ماذا يفعل

Booleans turn parts of the policy on or off without writing rules: httpd_enable_homedirs, httpd_can_network_connect_db, samba_export_all_rw … setsebool NAME on changes it now; add -P to keep it after reboot. semanage boolean -l shows descriptions.

طريقة الكتابة

getsebool -a | BOOLEAN...
setsebool [-PNV] BOOLEAN on|off|1|0 | BOOL1=VAL1 …

الخيارات 4

الأكثر استخدامًا

getsebool

-a
Show all booleans.

setsebool

-P
Permanent: also write it to the policy on disk.
-N
Do not reload the policy.
-V
Verbose errors.

أمثلة 10

$ مستخدم عادي# بصلاحية root (أو مع sudo)

  1. 1All web booleans

    getsebool -a | grep httpd

    on/off per boolean.

  2. 2One boolean

    getsebool httpd_enable_homedirs
    httpd_enable_homedirs --> off

    Off by default.

  3. 3Switch on permanently

    setsebool -P httpd_enable_homedirs on

    Survives a reboot.

  4. 4Only until reboot

    setsebool httpd_can_network_connect on

    For a quick test.

  5. 5Several at once

    setsebool -P httpd_can_network_connect_db=1 httpd_can_sendmail=1

    Name=value pairs.

  6. 6Descriptions

    semanage boolean -l | grep httpd_can_network_connect

    What the boolean allows.

  7. 7Only your changes

    semanage boolean -l -C

    Booleans that differ from the default.

  8. 8Find a boolean from the man page

    man httpd_selinux | grep -A2 httpd_use_nfs

    Needs selinux-policy-doc.

  9. 9NFS home folders

    setsebool -P use_nfs_home_dirs on

    Users with NFS homes can log in.

  10. 10Audit risky booleans (security)

    getsebool -a | grep -E 'httpd_execmem|httpd_unified|allow_execstack|selinuxuser_execstack' 

    Booleans that weaken protection should stay off unless needed.

رموز الخروج

0 :: Done. 1 :: Error (unknown boolean, not allowed).

الدليل الكامل

هذه الصفحة تشرح الأمر بكلمات بسيطة. الدليل الأصلي فيه كل التفاصيل.

في الطرفية: man 8 getsebool