查看SELinux状态:
[root@localhost ~]# getenforceEnforcing
临时关闭SELinux:
[root@localhost ~]# setenforce 0[root@localhost ~]# getenforcePermissive
永久关闭SELinux:
在 /etc/sysconfig/ 目录下修改配置文件 selinux
[root@localhost ~]# vim /etc/sysconfig/selinux
配置文件内容:
# 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 three values:# targeted - Targeted processes are protected,# minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection.SELINUXTYPE=targeted
将配置文件中的
SELINUX=enforcing
改为:
SELINUX=disabled
修改完成后要使配置生效需要重启服务器
重启服务器后查看SELinux状态:
[root@localhost ~]# getenforceDisabled