selinux 是由美国NSA国家安全局提供的一套基于内核的增强的强制安全保护机制,针对用户,进程,文档标记安全属性并实现保护性机制。
SELinux安全体系直接集成在Linux内核中,包括三种运行模式:
disabled:彻底禁用,内核在启动时不加载SELinux安全体系
enforcing: 强制启用,内核加载SELinux安全体系,并强制执行保护策略
permissive:宽松模式,内核加载 SELinux安全体系,只记录不执行
查看当前模式:
# getenforce
Disabled //表示当前为彻底禁用模式
enforcing //表示强制启用模式
permissive //宽松模式
查看当前模式
getenforce
Enforcing
临时切换宽松模式
setenforce 0
[root@hello ~]# getenforce
Permissive
永久设置selinux需要修改配置文件 /etc/selinux/config
[root@server0 ~]# vim /etc/selinux/config
SELINUX=enforcing
.. ..
2)重启验证结果
[root@server0 ~]# reboot
.. ..
[root@server0 ~]# getenforce
Enforcing