How to Check whether SELinux is Enabled or Disabled [ID 432988.1]

Applies to:

Linux OS - Version: 4.0 to 5.3 - Release: RHEL4 to OEL5U3
Linux x86
Linux x86-64
Linux Itanium
***Checked for relevance on 19-Jan-2011***
Linux Kernel - Version: 4.0 to 5.3

Goal

From SELinux Frequently Asked Questions (FAQ):
Security-enhanced Linux (SELinux) is a reference implementation of the Flask security architecture for flexible mandatory access control. It was created to demonstrate the value of flexible mandatory access controls and how such controls could be added to an operating system. The Flask architecture has been subsequently mainstreamed into Linux® and ported to several other systems, including the Solaris™ operating system, the FreeBSD® operating system, and the Darwin kernel, spawning a wide range of related work. The Flask architecture provides general support for the enforcement of many kinds of mandatory access control policies, including those based on the concepts of Type Enforcement®, Role-based Access Control, and Multi-level Security.
RedHat and Oracle Enterprise Linux provides the SELinux functionality. How one can check whether SELinux is enabled on a system or not?


Solution

SELinux may be in three different modes: Enforcing (or known as enabled), Disabled or Permissive.

Permissive mode loads the SELinux software, but doesn't enforce the rules, only logging is performed.

use this command to check current status:

# /usr/sbin/getenforce

The output will be either of the 3 options described above. For more verbose (in the case of permissive), use:

# /usr/sbin/sestatus


To programmatically check the status as a true/false, one way could be:
 
 
# /usr/sbin/selinuxenabled; if [ $? -ne 0 ]; then echo "DISABLED"; else echo "ENABLED"; fi
This will return ENABLED or DISABLED.[@more@]

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/161195/viewspace-1055554/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/161195/viewspace-1055554/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值