Selinux disable temporarily or permanently

Sometime when you run an application in Linux, it starts and suddenly stops or just doesn’t work. Then you find that its selinux which is stopping you to run your application.

Selinux is good security feature of Linux stop you to execute malicious applications. But it need to disable when you need to run your self developed application. You can check the selinux status by using following command:

# cat /selinux/enforce


If it will show 1, that means selinux enforcing is enabled.

You can disable that selinux temporarily or permanently. Use following methods to disable it.

Disable Temporarily:

To disable selinux temporarily set the 0 to /selinux/enforce file.

# echo 0 > /selinux/enforce

You can also use another command to disable selinux:

# setenforce 0

To check the status again;

# cat /selinux/enforce


NOTE: Above will disable the selinux at run-time, it will enable again after system reboot.

Disable Permanently:

To disable selinux permanently, modify the /etc/selinux/config file and set the SELINUX=disabled as follows:

 # cat /etc/selinux/config



NOTE: Above will disable the selinux permanently, but it will require system reboot to take effect.

Now you can disable selinux as you required.