临时和永久关闭SELinux

安全增强型Linux(Security-Enhanced Linux)简称SELinux,类似于Windows中的某种安全管家软件中的“沙箱”,一般在国内的生产环境中都不开启,所以在此也将其关闭。有两种关闭方式——临时关闭和永久关闭。临时关闭不需要重启主机,但重启主机后会失效;永久关闭需要修改配置文件,并重启主机则生效,并且永久有效。

1.临时关闭

#查看SELINUX 状态
[root@testhost etc]# getenforce 
Disabled
#0表示关闭,1表示开启。
[root@testhost etc]# setenforce 0
setenforce: SELinux is disabled

2.永久关闭(重启永久生效)

[root@testhost selinux]# vim config
将SELINUX=enforcing
改为SELINUX=disabled
[root@testhost selinux]#reboot #重启主机

最后更新于

这有帮助吗?