Disable SELinux in CentOS 7


This article will provide the steps to disable SELinux in CentOS 7. SELinux is a security enhancement to Linux which allows users and administrators more control over access control.

The following guide requires root user access.

Temporarily Disable SELinux

To temporarily disable SELinux in CentOS 7, perform the following steps:

  1. From the command line, login as root user.
  2. Run the command:
    setenforce 0
  3. Check the status of SELinux with the following command:
    sestatus

SELinux has now been disabled for the current session.

Permanently Disable SELinux

To permanently disable SELinux in CentOS 7, perform the following steps:

  1. From the command line, login as root user.
  2. Open the /etc/selinux/config file with your preferred text editor and change the SELINUX value to disabled:
    # 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=disabled
    # SELINUXTYPE= can take one of these two values:
    #       targeted - Targeted processes are protected,
    #       mls - Multi Level Security protection.
    SELINUXTYPE=targeted
  3. Reboot your CentOS server with the following command:
    reboot
  4. When the server boots up, verify SELinux status with the command:
    sestatus

SELinux has now been disabled on your CentOS 7 server.

  • disable selinux, selinux
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

View Server PHP Environment with phpinfo.php

The phpinfo() function outputs a huge amount of information about the system you're using, such...

How to Change Root Password Using SSH

This article explains the method of changing the root password on a Linux Server using SSH....

How to Create Sudo User on CentOS

This article provides step-by-step setup guide for adding Sudo user to CentOS system. The sudo...

How to Use Sudo

This article provides a guide to using a Sudo user on CentOS server. From the command line,...

Set Server Time Zones with Timedatectl

This article provides a guide to setting the server time and server time zone settings using...