ITPub博客

首页 > Linux操作系统 > Linux操作系统 > How to Disable or set SELinux to Permissive mode [ID 457458.1]

How to Disable or set SELinux to Permissive mode [ID 457458.1]

原创 Linux操作系统 作者:msdnchina 时间:2011-10-10 13:52:03 0 删除 编辑

Applies to:

Linux OS - Version: Enterprise Linux 4.0 to Oracle Linux 5.0 - Release: RHEL4 to OL5
Linux x86
Linux x86-64
Linux Kernel - Version: 4.0 to 5.0

Goal

How to fully disable SELinux (Security Enhanced Linux); or set it to "permissive" mode, in which case the SELinux software is loaded, but no enforcing is made of the rules, only logging is performed.


Please note that disabling SELinux or setting to "permissive" mode may have some security considerations. It is possible to keep SELinux enabled, and add manual exclusion rules.

Solution

To completely disable SELinux, use either of these methods:

1. Edit /etc/selinux/config
  • Change the SELINUX value to "SELINUX=disabled".
  • Reboot the server.
2. Append kernel boot options
  • Edit the kernel boot line and append "selinux=0" to the kernel boot options. For example:
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=LABEL=/ rhgb quiet selinux=0
initrd /initrd-2.6.9-42.ELsmp.img
  • Reboot the server.

To set SELinux to Permissive mode, use either of these methods:

1. Edit /etc/selinux/config
  • Change the SELINUX value to "SELINUX=permissive".
  • Reboot the server.
2. Append kernel boot options
  • Edit the kernel boot line and append "enforcing=0" to the kernel boot options (Assuming SELinux is not set to disabled as in section above). For example:
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp)
root (hd0,0)
kernel /vmlinuz-2.6.9-42.ELsmp ro root=LABEL=/ rhgb quiet enforcing=0
initrd /initrd-2.6.9-42.ELsmp.img
  • Reboot the server.

To check the status of SELinux, issue:

# /usr/sbin/sestatus

See Note 432988.1 for more details on checking SELinux status. [@more@]

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/161195/viewspace-1055555/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-07-30

  • 博文量
    498
  • 访问量
    1542552