linux,

How to disable SELinux

Aug 16, 2021 · 1 min read · Post a comment

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 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 bash environment

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.