linux临时或者永久关闭selinux
Contents
Linux临时或者永久关闭selinux
搭建测试环境或者搭建特殊环境需要临时/永久关闭关闭selinux 查看方法
[root@master ~]# getenforce
Enforcing
输出为“Enforcing”则证明selinux正在运行 输出为“Disabled”则证明selinux已经关闭 若输出为“Enforcing” 想临时关闭: [root@master ~]# setenforce 0 若想永久禁用selinux则需要编辑配置文件 [root@master ~]# vim /etc/selinux/config 将SELINUX=enforcing改成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 these three values:
targeted - Targeted processes are protected,
minimum - Modification of targeted policy. Only selected processes are protected.
mls - Multi Level Security protection.
SELINUXTYPE=targeted
更改后的配置文件
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
SELINUX=disabled
SELINUXTYPE= can take one of these three values:
targeted - Targeted processes are protected,
minimum - Modification of targeted policy. Only selected processes are protected.
mls - Multi Level Security protection.
SELINUXTYPE=targeted