安全增强型 Linux(Security-Enhanced Linux)简称 SELinux,它是一个 Linux 内核模块,也是 Linux 的一个安全子系统。SELinux 主要由美国国家安全局开发。2.6 及以上版本的 Linux 内核都已经集成了 SELinux 模块。
SELinux 的结构及配置非常复杂,而且有大量概念性的东西,要学精难度较大,目前各种云的云防火墙WEB化管理能满足绝大多数企业的安全需求,因此大部分情况下都会把 SELinux 关闭。
查看状态:
/usr/sbin/sestatus -v
SELinux status: enabled
enabled即为开启状态
永久关闭:
通过修改 source /etc/selinux/config 并重启系统永久关闭
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@localhost ~]# grep SELINUX /etc/selinux/config
# SELINUX= can take one of these three values:
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
SELINUXTYPE=targeted
临时关闭:
运行命令setenforce立即关闭,但是重启系统失效
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive