How to Disable SELinux on CentOS 7

How to Disable SELinux on CentOS 7

SELinux (Security-Enhanced Linux) is a part of Linux security module that allows administrator and users more control over access control. SELinux relies on mandatory access control that restrict users to rule and policies set by the administrator.

SELinux mode:- There are three mode of SELinux

Enforcing mode is the default mode of SELinux.

Permissive mode is the most commonly used mode for troubleshooting SELinux.

Disabled mode means that SELinux is turned off and security policies do not work on the server.

If you want to disable SELinux on your server first check status of the SELinux


[root@localhost tomcat]# sestatus

SELinux status:                 enable
[root@localhost tomcat]#

For disable SELinux

If you temporary change the SELinux from targeted to permissive with using sudo setenforce 0 command

This change will be valid only this session only if u restart your system this is automatically changed.
For permanently disable SELinux use mention command

#vi /etc/selinux/config

# 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=enable change here and type disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.

Use Esc key and :wq 

And restart your server

and after restart your server check the status of SELinux


[root@localhost tomcat]# sestatus

SELinux status:                 disabled
[root@localhost tomcat]#

Post a Comment