Centos7下查看并关闭selinux

简介: Centos7下查看并关闭selinux

【1】查看selinux状态

sestatus;
getenforce


aHR0cHM6Ly9pbWctYmxvZy5jc2RuLm5ldC8yMDE4MDMxNTE4MTMzNTI5ND93YXRlcm1hcmsvMi90ZXh0L0x5OWliRzluTG1OelpHNHVibVYwTDBvd09EQTJNalE9L2ZvbnQvNWE2TDVMMlQvZm9udHNpemUvNDAwL2ZpbGwvSTBKQlFrRkNNQT09L2Rpc3NvbHZlLzcw.png


【2】永久关闭selinux

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
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#   minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 



设置SELINUX=disabled 然后重启reboot.



临时关闭

  • 服务器重启,不是那么随意的,可以使用命令临时关闭。
setenforce 1 设置SELinux 成为enforcing模式
setenforce 0 设置SELinux 成为permissive模式(使用该命令)


目录
相关文章
|
2月前
|
安全 Linux 数据安全/隐私保护
CentOS中SELinux的禁用与关闭操作
在禁用SELinux时,你要时刻谨慎小心。SELinux提供了安全功能,并阻止了许多常见的网络攻击,关闭它可能会让你的系统置于风险之中。除非非常确定SELinux为你带来了不必要的麻烦,否则最好的选择往往是留着它,适当地调整和细化你的SELinux策略,来适应你的需求。
395 19
|
Linux 网络安全
iptables防火墙限制 centos中有 firewalld selinux 还有 iptables
iptables防火墙限制 centos中有 firewalld selinux 还有 iptables
148 0
iptables防火墙限制 centos中有 firewalld selinux 还有 iptables
|
Linux
CentOS/RHEL 7 “Failed to load selinux policy, freezing” 问题的解决
嘿!!!您在启动过程中是否遇到过此类问题。
437 0
CentOS/RHEL 7 “Failed to load selinux policy, freezing” 问题的解决
|
运维 安全 大数据
【精通Linux系列】Centos7的防火墙及selinux介绍与端口的使用
【精通Linux系列】Centos7的防火墙及selinux介绍与端口的使用
397 0
【精通Linux系列】Centos7的防火墙及selinux介绍与端口的使用
|
关系型数据库 MySQL Linux
|
Web App开发 安全 Linux