[[email protected] ~]# yum -y install setroubleshoot
[[email protected] ~]# yum -y install setools-console
[[email protected] ~]# 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
#指定SELinux的執行模式。有enforcing(強制模式)、permissive(寬容模式)、disabled(不生效)三種模式
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
#指定SELinux的預設策略。有targeted(針對性保護策略,是預設策略)和mls(多級安全保護策略)兩種策略
[[email protected] ~]# getenforce
#查詢SELinux的執行模式
Enforcing
#當前的SELinux是強制模式
[[email protected] ~]# setenforce 選項
選項:
[[email protected] ~]# setenforce 0
#切換成寬容模式
[[email protected] ~]# getenforce
Permissive
[[email protected] ~]# setenforce 1
#切換成強制模式
[[email protected] ~]# getenforce
Enforcing
[[email protected] ~]# sestatus
SELinux status: enabled
#SELinux啟用
SELinuxfs mount: /selinux
#SELinux資料的掛載位置
Current mode: enforcing
#執行模式是強制模式
Mode from config file: enforcing
#組態檔所指定的模式也是強制模式
Policy version: 24
#策略版本
Policy from config file: targeted
#目前策略是針對性保護策略