当我们安装好linux(如Redhat、CentOS等)后,selinux为打开状态(enforcing),我们需要将其关掉使用如下方法:
以Redhat为例:
编辑/etc/selinux/config文件或者编辑/etc/sysconfig/selinux文件
# vi /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=disable
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
将SELINUX=enforcing 改成 SELINUX=disable
然后重启系统即可
若不想重启系统,可是使用如下方法生效:
# getenforce --原来
Enforcing
# setenforce 0
# getenforce --执行命令后
Permissive
如果想打开selinux,将disable改成enforcing即可