配置SELINUX

时间:2023-11-17 12:01:38

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: # getenforce
Permissive

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

# setenforce
# getenforce
Enforcing
# setenforce
# getenforce
Permissive
#

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