CentOS下查看SeLinux状态及关闭

setenforce是Linux的selinux防火墙配置命令 执行setenforce 0 表示关闭selinux防火墙。
setenforce命令是单词set(设置)和enforce(执行)连写,另一个命令getenforce可查看selinux的状态。

一、查看SELinux状态:

/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态
SELinux status:            enabled
Current mode:              permissive

SELinux status:            enabled
Current mode:              enforcing

  • getenforce  ##也可以用这个命令检查

# getenforce
Enforcing

# getenforce
Permissive

2、关闭SELinux:

  • 临时关闭(不用重启机器):
setenforce 0                  ##设置SELinux 成为permissive模式
setenforce 1                   ##设置SELinux 成为enforcing模式
  • 修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可

CentOS下查看SeLinux状态及关闭》上有1条评论

  1. Pingback引用通告: 解决Nginx的connect() to 127.0.0.1:8080 failed (13: Permission denied) | 精彩每一天

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>