zoukankan      html  css  js  c++  java
  • SELinux 宽容模式(permissive) 强制模式(enforcing) 关闭(disabled)

    SElinux共有3中状态。
    1、selinux的配置文件:/etc/selinux/config
    # This file controls the state of SELinux on the system.
      3 # SELINUX= can take one of these three values:
      4 #     enforcing - SELinux security policy is enforced.
      5 #     permissive - SELinux prints warnings instead of enforcing.
      6 #     disabled - No SELinux policy is loaded.
      7 SELINUX=permissive
      8 # SELINUXTYPE= can take one of three two values:
      9 #     targeted - Targeted processes are protected,
     10 #     minimum - Modification of targeted policy. Only selected processes are     protected.
     11 #     mls - Multi Level Security protection.
     12 SELINUXTYPE=targeted

    enforcing:强制模式,代表 SELinux 运作中,且已经正确的开始限制 domain/type 了; permissive:宽容模式:代表 SELinux 运作中,不过仅会有警告讯息并不会实际限制 domain/type 的存取。这种模式可以运来作为 SELinux 的 debug 之用;

    disabled:关闭,SELinux 并没有实际运作。
    2、查看现在selinux的状态:
    sestatus

    3、永久改变selinux的状态,需要重新开机,因为,selinux是整合到内核的模块。
    4、临时关闭selinux:setenforce 0
    5、临时打开,由permissive转enforcing:setenforce 1
    6、使用sed命令修改selinux的配置文件:
    sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config 
    解说:/SELINUX/为包含匹配以//内字符的行
    s为替换命令
    sed -i 表示直接修改源文件,没有-i只是把修改输出到标准输出,并不修改源文件。
    s/要查找的字符串/改后的字符串/
    注意,整个命令要用单引号引起来。
    最后跟上文件名
  • 相关阅读:
    Java子类与父类的初始化
    悠哈牛奶糖为什么有五种味道单独装的,而不是混合装的
    C++ TinyXml操作(含源码下载)
    动物园海洋馆
    冰上行走
    Tmux : GNU Screen 的替代品
    考虑使用jruby
    关于一些展现的框架
    python抓取google搜索url
    pythonwebkit
  • 原文地址:https://www.cnblogs.com/litifeng/p/6939730.html
Copyright © 2011-2022 走看看