Off SELinux, and/etc Selinux/config and Sysconfig/selinux differences

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.