Celebrate Our 22nd Anniversary with Huge Savings! Up to 70% Off

How to Disable SELinux on CentOS?

Security-Enhanced Linux, also known as SELinux, is a security module of the Linux kernel which provides security policies on your Linux Distribution. 

It is a set of kernel modifications added to Linux Distributions and includes access controls for security policies.

How to Disable SELinux Temporarily?

First, let us check the SELinux Status with the commands given below – 

SEstatus

SELinux status: enabled
SELinuxfs mount: /selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allow
Memory protection checking: actual (secure)
Max kernel policy version: 26

 

As per the above data, SELinux is up and running. 

You can temporarily disable the SELinux by following the steps given below – 

# setenforce 0

# setenforce Permissive

As mentioned, this command can temporarily block the SELinux. However, SELinux will be enabled again once the server is rebooted.

How to Disable SELinux Permanently?

1. You can find the SELinux configuration file at /etc/selinux/config.
    We can modify it to disable SELinux.

# vi /etc/selinux/config

2. Find SELinux and change it to disable status

# SELINUX=disabled

3. Save the file with :wq and reboot the server.

4. Recheck the SEstatus; it should be disabled now. 

# sestatus



Was this answer helpful?

« Back

chat