Disable SELinux on CentOS or RHEL 5/5.1/5.2/5.3/5.4/5.5/5.6/5.7
SELinux abbreviated as Security-Enhanced Linux, it implements the security policies on Linux and provides additional level access controls. it was originally developed by United States National Security Agency. From CentOS 5 SELinux enabled by default. There are some circumstance you are not required addition level access controls that time you may want to disable it. Here is the small guide to disable SELinux.
Method 1:
Switch to root user.
[[email protected]]$ su -
Password:
Edit the /etc/selinux/config.
[[email protected]]# vi /etc/selinux/config
Change SELinux=enforcing
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
to SELinux=disabled
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
This will disable SELinux on next reboot.
To disable SELinux without rebooting, use the following command.
[[email protected]]# setenforce 0
This will disable SELinux until you reboot the system.
Method 2:
Type the following command in Terminal.
[[email protected]]# setup
You will get the following window, select firewall configuration and select OK and press Enter.
Disable it by using Tab and Select OK and press Enter.
Select Quit and Hit Enter and Now the SELinux disabled message will appear in terminal.
Method 3:
Type the following command in Terminal.
[[email protected]]# lokkit
Or
[[email protected]]# system-config-securitylevel-tui
You will get the following firewall configuration sreen, Tab to select the SELinux disabled and also select OK, then press Enter.
Now you will get SELinux disabled message in terminal. That’s all! you have sucessfuly disabled SELinux on CentOS 5. Here is the tutorial about how to disable SELinux under CentOS 6.