Disabling SELinux

Patrick Gichini
MindNinja
Published in
2 min readMar 29, 2019

SELinux is a security module that provides a way to support access control policies. It has been added to various Linux distributions over the years.

During the installation of various software, you will often find the authors request you to disable SELinux for the software to work well. While I am mostly against this and would advise just editing the SELinux settings rather than disabling it wholly, here’s how you do it pretty quickly.

First thing is usually to check your SELinux status which you do by running:

$sestatus

on your terminal. By default, it will always be enabled.

To access the SELinux settings, you can either open two files:

$sudo vi /etc/sysconfig/selinux

or:

$sudo vi /etc/selinux/config

Of course, we’ll use vi and not nano like some peasant

You’ll get a file that look’s like:

# 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 three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected #processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

SELinux has three states:

  1. enforcing — this is SELinux’s full ninja mode. if you are here, I hope you know your stuff :-)
  2. permissive — at this mode, SELinux doesn’t enforce any rules but it still reports what is happening. this is the recommended mode.
  3. disabled — thou shall never disable thy SELinux! In this mode, SELinux is turned off.

Funny that I am teaching you to do just that, disabling. Simply edit the enforcing and write disabled.

You might have to restart your machine before it takes effect.

Have fun!

--

--

Patrick Gichini
MindNinja

Linux Ninja | Data Enthusiast | Sentimental Poet | Agent Boyfriend