CentOS 7.2 默认开启了 SELinux,我们可以根据业务需要选择是否关闭或开启
- 关闭 SELinux
- 开启 SELinux
关闭 SELinux
# setenforce 0
修改 /etc/selinux/config
配置文件,修改 SELINUX 参数为 disabled,如下所示:
# 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=disabled # SELINUXTYPE= can take one of three 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
# setenforce 1
修改 /etc/selinux/config
配置文件,修改 SELINUX 参数为 disabled,如下所示:
# 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 two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted