Tuesday, 6 March 2018

How to Enable or Disable SELinux on CentOS/RHEL 7

1. Verify the current status:


[root@sankar-HP ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)

[root@sankar-HP ~]# uname -a
Linux AT-LC-CHAMBERLIN 3.10.0-693.17.1.el7.x86_64 #1 SMP Thu Jan 25 20:13:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux


[root@sankar-HP ~]# sestatus
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:      28

2. Open a selinux config file,
[root@sankar-HP ~]# vi /etc/sysconfig/selinux

# 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 three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


[root@sankar-HP ~]#reboot
[root@sankar-HP ~]# sestatus
SELinux status:                 disabled


No comments:

Post a Comment