一、在rhel7下
1、临时关闭selinux
setenforce 0
[root@wrx ~]# setenforce 0 setenforce: SELinux is disabled
2、永久关闭selinux
修改/etc/sysconfig/selinux
[root@wrx ~]# vim /etc/sysconfig/selinux # 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 these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
3、临时打开selinux
setenforce 1
4、永久打开selinux 自开机启动
修改/etc/sysconfig/selinux
5、查看selinux状态
[root@wrx ~]# setenforce 1 setenforce: SELinux is disabled [root@wrx ~]# getenforce Disabled [root@wrx ~]# sestatus SELinux status: disabled
二、在rhel6.5下
1、临时关闭selinux
setenforce 0
2、永久关闭selinux
修改/etc/sysconfig/selinux
配置如下:
#SELINUX=enforcing
SELINUX=disabled
或者使用下面命令
sed -i '/SELINUX/s/enforcing/disabled/' /etc/sysconfig/selinux
3、临时打开selinux
setenfofrce 1
4、永久打开selinux 自开机启动
修改/etc/sysconfig/selinux
5、查看selinux状态
[root@wrx ~]# setenforce 1 setenforce: SELinux is disabled [root@wrx ~]# getenforce Disabled [root@wrx ~]# sestatus SELinux status: disabled