How To Disable SELinux From Centos 7 Server
Now I want to share how easy way to disable selinux from centos 7 server. Some time selinux on then you can’t run any service so this is very important on your server. Now goto server for disable selinux from centos 7 server.
Step #01: First check selinux service using this command.
[[email protected] #] sestatus
Output like below
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
you can disable temporary using below command.
[[email protected] #] setenforce 0
Step #02: To permanently disable SELinux from your CentOS 7 server
Open this file /etc/selinux/config then replace enforcing to disabled
[[email protected] #] vi /etc/selinux/config
You see like below
# 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 these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
So change this SELINUX=disabled then save file for Esc :wq press Enter.
Now reboot your server then check status using below command.
[[email protected] #] sestatus
Output like below this
SELinux status: disabled
I think properly disable selinux from your centos 7 server.