CentOS7关闭防火墙和selinux

    一、关闭防火墙并禁止开机自启:

[root@localhost nginx-1.14.2]# systemctl disable --now firewalld

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

    二、 关闭selinux:

     1、 查看SELinux状态:

   1) /usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态

##目前 SELinux 支持三种模式,分别如下:

     enforcing :强制模式,代表 SELinux 运作中,且已经正确的开始限制 domain/type 了;

     permissive:宽容模式:代表 SELinux 运作中,不过仅会有警告讯息并不会实际限制

                          domain/type 的存取。这种模式可以用来作为 SELinux 的 debug 之用;

      disabled :关闭,SELinux 并没有实际运作

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

    2、关闭SELinux:

1)临时关闭(不用重启机器):

setenforce 0                  ##设置SELinux 成为permissive模式

                                      ##setenforce 1 设置SELinux 成为enforcing模式

2)修改配置文件(需重启机器):

vim /etc/selinux/config 文件

将SELINUX=enforcing改为SELINUX=disabled

或者执行:

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

然后重启机器即可

firewalld详解:https://www.cnblogs.com/vicowong/p/11210144.html

selinux详解:https://blog.csdn.net/yanjun821126/article/details/80828908

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。