关闭SELinux功能
先查看SELINUX配置文件
[root@shuai ~]# cat /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
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
vi /etc/selinux/config
[root@shuai ~]# cat /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
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
将SELINUX=enforcing改为SELINUX=disable
也可以使用
sed -i ‘s#SELINUX=enforcing#SELINUX=disabled#g’ /etc/selinux/config
直接将SELINUX修改为disabled
使用getenforce命令查看SELinux发现还是Enforcing,我们配置文件改好了,怎么生效呢,当然重启是可以的,但是我们的服务器是不允许随意重启的,因为重启需要时间,在重启的时候用户就访问不了你的网站了,所以我们不能重启
使用setenforce 0命令临时生效,下次重启自动生效