配置SELINUX

selinux的配置文件:
# more /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 two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

查看selinux的状态:

# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28

# getenforce
Permissive

设置selinux:(这样修改后立即生效,重新系统后该配置取消)

# setenforce 1
# getenforce
Enforcing
# setenforce 0
# getenforce
Permissive
# 

要想修改永久生效,直接修改配置文件/etc/selinux/config,然后重启系统。

原文地址:https://www.cnblogs.com/abclife/p/4727185.html