Selinux CentOS Linux

Introduction

conf

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

Check the status

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: permissive Policy MLS status: enabled Policy deny_unknown status: allowed Max kernel policy version: 33

Switch SELinux to permissive mode

Manually or with sed replace SELINUX=enforcing with SELINUX=permissive

sed -i 's/SELINUX=enforcing/SELINUX=permissive/' config
setenforce

Check the change

sestatus | grep "Current mode"

Current mode: permissive

Shut down the computer

sudo shutdown -r now

Disable SELinux

Manually or with sed replace SELINUX=enforcing with SELINUX=disabled

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' config
sudo shutdown -r now

Check

sestatus

SELinux status: disabled

Article author: Andrei Olegovich

Banner image