一、临时关闭
[root@localhost ~]# getenforce #查看SELinux状态
Enable
[root@localhost ~]# setenforce 0 #0代表关闭,1代表开启
setenforce: SELinux is disabled
二、永久关闭
将SELINUX=enforcing 改成 SELINUX=disabled,重启之后生效
[root@localhost ~]# vim /etc/selinux/config
1
2 # This file controls the state of SELinux on the system.
3 # SELINUX= can take one of these three values:
4 # enforcing - SELinux security policy is enforced.
5 # permissive - SELinux prints warnings instead of enforcing.
6 # disabled - No SELinux policy is loaded.
7 SELINUX=disabled
8 # SELINUXTYPE= can take one of three two values:
9 # targeted - Targeted processes are protected,
10 # minimum - Modification of targeted policy. Only selected processes are pro tected.
11 # mls - Multi Level Security protection.
12 SELINUXTYPE=targeted
[root@localhost ~]# reboot #重启生效