【1】查看selinux状态
sestatus; getenforce
【2】永久关闭selinux
vim /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, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
设置SELINUX=disabled
然后重启reboot
.
临时关闭
- 服务器重启,不是那么随意的,可以使用命令临时关闭。
setenforce 1 设置SELinux 成为enforcing模式 setenforce 0 设置SELinux 成为permissive模式(使用该命令)