linux,

How to disable SELinux

Aug 16, 2021 · 1 min read · Post a comment
How to disable SELinux

You may face Nginx or Apache web server blocking issues even when your firewall is disabled. SELinux is a security engine that may block some of the calls or permissions on your server. So in this tutorial I will cover the steps on how to disable SELinux temporarily and permanently.

Prerequisites

  • Linux Distro

Disable SELinux Temporarily

Step 1. Check the selinux status:

sestatus

Step 2. To disable it temporarily, run:

setenforce 0

Disable SELinux Permanently

Step 1. Open the selinux configuration file:

nano /etc/sysconfig/selinux

Step 2. Find the SELINUX configuration line and change it from SELINUX=enforcing to SELINUX=disabled

SELINUX=disabled

Step 3. Save the file and exit. You need to reboot the system. Check the new status:

sestatus

Output:

SELinux status: disabled

Conclusion

This is a quick and easy tutorial where you can learn how to disable selinux temporarily or permanently depending on your requirements. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on telegram.