User Tools

Site Tools


selinux:turn_off_selinux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
selinux:turn_off_selinux [2019/12/04 20:31] – removed peterselinux:turn_off_selinux [2020/07/24 07:20] (current) – old revision restored (2016/07/11 14:09) 92.220.10.100
Line 1: Line 1:
 +===== SELinux - Turn off SELinux =====
 +
 +Type the following command:
 +
 +<code bash>
 +echo 0 >/selinux/enforce
 +</code>
 +
 +You can also use the setenforce command to effectively disable it, enter:
 +
 +<code bash>
 +setenforce Permissive
 +</code>
 +
 +OR
 +
 +<code bash>
 +setenforce 0
 +</code>
 +
 +The above commands will switch off SELinux enforcement temporarily until the machine is rebooted.  If you would like to make it permanently, edit /etc/sysconfig/selinux, enter:
 +
 +<code bash>
 +vi /etc/sysconfig/selinux
 +</code>
 +
 +And set / update it as follows:
 +
 +<file bash /etc/sysconfig/selinux>
 +SELINUX=disabled
 +</file>
 +
 +Save and close the file.  The above will only work in CentOS, Fedora and RedHat Enterprise Linux systems.  For all other Linux distros edit your boot loader config file (LILO or GRUB boot loader config file such as /boot/grub/grub.conf).  Find the kernel line, append enforcing=0 at the end:
 +
 +<file /boot/grub/grub.conf>
 +title Red Hat Enterprise Linux Server (2.6.18-194.26.1.el5)
 +        root (hd0,0)
 +        kernel /vmlinuz-2.6.18-194.26.1.el5 ro root=LABEL=/ console=tty0 console=ttyS1,19200n8 enforcing=0
 +        initrd /initrd-2.6.18-194.26.1.el5.img
 +</file>
 +
 +Finally, reboot the system:
 +
 +<code bash>
 +reboot
 +</code>
 +
 +
 +===== Grub =====
 +
 +SELinux is often also configured in the grub bootup configuration.  
 +
 +If you can’t locate the /etc/selinux/config file on your system, you can pass disable SELinux by passing it as parameter to the Grub Boot Loader as shown below.
 +
 +Search **/boot/grub/grub.conf** file using grep and make sure the following line **DOES NOT** appears:
 +
 +<code bash>
 +egrep -i 'selinux=0|enforcing=0' /boot/grub/grub.conf
 +</code>
 +
 +If you found lines with selinux=0 or enforcing=0, remove them and save the changes.
 +
 +Example:
 +
 +<file bash /boot/grub/grub.conf>
 +# cat /boot/grub/grub.conf
 +default=0
 +timeout=5
 +splashimage=(hd0,0)/boot/grub/splash.xpm.gz
 +hiddenmenu
 +title Enterprise Linux Enterprise Linux Server (2.6.18-92.el5PAE)
 +root (hd0,0)
 +kernel /boot/vmlinuz-2.6.18-92.el5PAE ro root=LABEL=/ rhgb quiet selinux=0
 +initrd /boot/initrd-2.6.18-92.el5PAE.img
 +title Enterprise Linux Enterprise Linux Server (2.6.18-92.el5)
 +root (hd0,0)
 +kernel /boot/vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet selinux=0
 +initrd /boot/initrd-2.6.18-92.el5.img
 +</file>
 +Reboot the server:
 +
 +<code bash>
 +reboot
 +</code>
  
selinux/turn_off_selinux.1575491503.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki