美文网首页
[rhel7] 3. 关闭SELinux

[rhel7] 3. 关闭SELinux

作者: 飞跑的蛤蟆 | 来源:发表于2017-03-21 22:15 被阅读1226次
    • 查看SELinux是否关闭
      第一种方法:显示permissive即为开启状态。
    [root@localhost weibo]# getenforce
    Permissive
    

    第二种方法:显示为enabled即为开启状态。

    [root@localhost weibo]# /usr/sbin/sestatus -v
    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
    
    Process contexts:
    Current context:                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
    Init context:                   system_u:system_r:init_t:s0
    /usr/sbin/sshd                  system_u:system_r:sshd_t:s0-s0:c0.c1023
    
    File contexts:
    Controlling terminal:           unconfined_u:object_r:user_devpts_t:s0
    /etc/passwd                     system_u:object_r:passwd_file_t:s0
    /etc/shadow                     system_u:object_r:shadow_t:s0
    /bin/bash                       system_u:object_r:shell_exec_t:s0
    /bin/login                      system_u:object_r:login_exec_t:s0
    /bin/sh                         system_u:object_r:bin_t:s0 -> system_u:object_r:shell_exec_t:s0
    /sbin/agetty                    system_u:object_r:getty_exec_t:s0
    /sbin/init                      system_u:object_r:bin_t:s0 -> system_u:object_r:init_exec_t:s0
    /usr/sbin/sshd                  system_u:object_r:sshd_exec_t:s0
    
    

    二、关闭SELinux的方法

    1. 临时关闭
    setenforce 1  # 设置为enforcing模式
    setenforce 0  # 设置为permissive模式
    
    1. 永久关闭,修改配置文件并重启系统。

    修改配置文件vim /etc/selinux/config并将其中的SELINUX的值设置为disabled

    将enforcing修改为disable.png
    1. 检查是否关闭
    [root@localhost weibo]# getenforce
    Disabled
    [root@localhost weibo]# /usr/sbin/sestatus -v
    SELinux status:                 disabled
    

    相关文章

      网友评论

          本文标题:[rhel7] 3. 关闭SELinux

          本文链接:https://www.haomeiwen.com/subject/ymgogttx.html