1
2
3
4
5
6
7
8
9
10
11
|
[root@moban ~]#cat /etc/selinux/config #此为Selinux的配置文件目录
# This filecontrols the state of SELinux on the system.
# SELINUX= cantake one of these three values:
# enforcing - SELinux security policy isenforced.
# permissive - SELinux prints warningsinstead of enforcing.
# disabled - No SELinux policy
is
loaded.
SELINUX=enforcing
# SELINUXTYPE=can take one of these two values:
# targeted - Targeted processes areprotected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
|
1
2
3
|
enforcing:开启Selinux
permissive:自由模式,此种模式下,只会打印警告消息,但不会阻止
disabled:关闭Selinux
|
1
|
[root@moban ~]# vi /etc/selinux/config
|
1
2
3
4
|
[root@moban ~]#sed -i s#SELINUX=enforcing#SELINUX=disabled#g /etc/selinux/conf
[root@moban ~]#grep
"disabled"
/etc/selinux/config
# disabled - No SELinux policy
is
loaded.
SELINUX=disabled
|
1
2
|
[root@moban ~]#getenforce
Enforcing
|
1
2
3
|
[root@moban ~]# setenforce
0
[root@moban ~]#getenforce
Permissive
|
1
2
3
4
5
|
[root@moban ~]#setenforce
1
[root@moban ~]#getenforce
Enforcing
[root@moban ~]# setenforce2
usage: setenforce [ Enforcing | Permissive |
1
|
0
]
|