version, each use will encounter some problems that are not known. Record down the process and learn some of the pits encountered.
* system version: CentOS Linux release 7.3.1611 (Core)
* system kernel: 3.10.0-514.el7.x86_64
#获取selinux状态信息
[email protected] ~]# Getenforce
Enforcing
#临时关闭selinux, the same as the original version.
[email protected] ~]# Setenforce 0
[email protected] ~]# Getenforce
Permissive
#问题就是在修改配置文件
#按照CentOS 6 To modify the configuration file location:/etc/sysconfig/selinux
[email protected] ~]# sed-i "s#selinux=enforcing#selinux=disabled#g"/etc/sysconfig/selinux
#一直以为这样就是可以了, no check. Until the service cobbler, Zabbix always error problem, check the log only found that the original SELinux no
shut up, crazy. Modified/etc/sysconfig/selinux did not take effect, then Baidu query found that there is such a command sestatus.
[email protected] conf.d]# Sestatus
SELinux status:enabled
selinuxfs Mount:/sys/fs/selinux
SELinux root directory:/etc/selinux
Loaded Policy name:targeted
Current mode:permissive
Mode from config file:enforcing
Policy MLS status:enabled
Policy Deny_unknown status:allowed
Max kernel policy version:28
#测试将原来的修改/etc/sysconfig/selinux,selinux status changed to enforcing
#然后将/etc/selinux/config,selinux Status modified to Disabled
[email protected] ~]# sed-i "s#selinux=enforcing#selinux=disabled#g"/etc/selinux/config
#重启
[email protected] ~]# reboot
#再次获取状态, it's closed.
[email protected] ~]# Getenforce
Disabled
#确认已经关闭了
[email protected] ~]# Sestatus
SELinux status:disabled
/etc/sysconfig/selinux and/etc/selinux/config configuration file links and differences
1. First/etc/sysconfig/selinux is/etc/selinux/config's soft link relationship
2. Because the script uses sed-i ' s/selinux=enforcing/selinux=disabled/g '/etc/sysconfig/selinux
Modify the/etc/sysconfig/selinux file to cause the soft connection relationship to break, become a normal file, and no longer be the system as the SELinux configuration file
3. Turn off SELinux, directly modify the/etc/selinux/config configuration file and reboot to take effect
Off SELinux, and/etc Selinux/config and Sysconfig/selinux differences