Centos7下查看并关闭selinux

青春须早为,岂能长少年。这篇文章主要讲述Centos7下查看并关闭selinux相关的知识,希望能为你提供帮助。
【1】查看selinux状态

sestatus;

getenforce


【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模式(使用该命令)

【Centos7下查看并关闭selinux】


    推荐阅读