How To Disable or Enable Selinux Temporarily or Permanently? – POFTUT

How To Disable or Enable Selinux Temporarily or Permanently?

I have fedora desktop. I want to run some services but I get error about selinux. How can I disable selinux?

Selinux is a security mechanism used generally linux systems. It has support from linux kernel. Selinux create context for specified services, applications and users. Prevent these to access unrelated or unsecure part of the linux systems. In this tutorial we will look how to disable and enable selinux temporary or persistently.

Get Status Of SELinux

Before enabling or disabling selinux status listing current status is very useful. We can use sestatus command which will show wether selinux is enabled or disabled.

Get Status Of SELinux

Get Status Of SELinux

If the sestatus is not installed we can install it in Ubuntu, Debian, Kali, Mint with the following command.

Disable SELinux Temporarily

We can disable SELinux in two mode. We can disable SELinux temporarily with the setenforce command . This type of command will be effective up to reboot. After reboot configured settings will be effective.

Disable SELinux Temporarily

Disable SELinux Temporarily

Disable SELinux Persistently

We can disable SELinux persistenly by changing /etc/selinux/config 

Open file with nano. We need to be root to edit this file.

We will se following lines. To disable SELinux SELINUX=disabled 

echo '

After this please reboot the system.

Enable SELinux Temporarily

We can enable SELinux temporarily which will effect up to reboot with setenforce 1 command which is the reverse of disable command.

LEARN MORE  How To Enable BitTorrent Ports In Linux Firewall?

Enable SELinux Persistently

Similar to the disable we will change above configuration file SELINUX=enforcing


How To Disable or Enable Selinux Temporarily or Permanently Infografic

Leave a Reply

Your email address will not be published. Required fields are marked *