关闭SELinux

SELinux的三种模式

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

 

查看SElinux的状态

1,查看配置信息 /usr/sbin/sestatus -v

 
 
# /usr/sbin/sestatus -v
SELinux status:                 enabled     #若为enabled表示开启,应该是读取/etc/selinux/config文件
SELinuxfs mount:                /selinux
Current mode:                   permissive   #实际上的模式(宽容模式)
Mode from config file:          enforcing
Policy version:                 24
Policy from config file:        targeted
Process contexts:
Current context:                unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
Init context:                   system_u:system_r:init_t:s0
/sbin/mingetty                  system_u:system_r:getty_t:s0
/usr/sbin/sshd                  system_u:system_r:sshd_t:s0-s0:c0.c1023
File contexts:
Controlling term:               unconfined_u:object_r:user_devpts_t:s0
/etc/passwd                     system_u:object_r:etc_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:init_exec_t:s0
/sbin/mingetty                  system_u:object_r:getty_exec_t:s0
/usr/sbin/sshd                  system_u:object_r:sshd_exec_t:s0

2,getenforce

# getenforce
Permissive    #实际上的模式(宽容模式)

 

 
 

关闭SElinux

1,修改配置文件/etc/selinux/config(需要重启)

# vim /etc/selinux/config
# 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=enforcing  ##改为disabled
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
 
 

2,getenforce(临时修改,不需重启,重启失效)

 
 

# getenforce 0
Permissive    # getenforce 1设置SELinux为enforcing模式,由于SELinux是直接整合到内核中,所以不可以直接disabled,只能强制在enforcing和permissive中转换。

转载于:https://www.cnblogs.com/bingxinguoke/p/4341402.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值