selinux详解
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了selinux详解相关的知识,希望对你有一定的参考价值。
查看selinux配置文件
[[email protected] ~]# cat /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
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改selinux为关闭状态
方法一
[[email protected] ~]# vi /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=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
在vi下按“i”进行编辑,讲enforcing改为disabled
按“esc”退出编辑模式,“:wq ” 保存退出
检查:cat /etc/selinux/config
方法二
设置:sed -i s#SELINUX=enforcing#SElINUX=disabled#g /etc/selinux/config
检查:grep "disable" /etc/selinux/config
以上永久关闭selinux,重启生效
查看selinux状态:
[[email protected] ~]# getenforce
Enforcing
临时关闭
[[email protected] ~]# setenforce 0
[[email protected] ~]# getenforce
Permissive
即时生效
以上是关于selinux详解的主要内容,如果未能解决你的问题,请参考以下文章