CentOS7永久关闭防火墙和SELinux

目录

一.查看防火墙的状态命令

(1)systemctl status firewalld       查看当前的防火墙状态

 二.暂时/永久关闭防火墙命令

(1)systemctl  stop firewalld         暂时关闭防火墙

(2)systemctl  disable firewalld         永久关闭防火墙 (需要重新启动系统才能生效)

三.临时/永久启动防火墙

(1)systemctl start firewalld        临时启动防火墙

(2)systemctl enable firewalld        永久启动防火墙(需要重新启动系统才能生效)

(3)如果遇到不能重启,可能是firewalld服务被锁定了,可能是使用下面命令

systemctl unmask firewalld     解开firewalld的锁定

systemctl start firewalld.service

四.查看SELinux状态

(1)getenforce      查看当前SELinux状态

(2)cat  /etc/selinux/config      查看selinux的配置文件看状态

五.临时/永久关闭SELinux

(1)setenforce 0            临时禁用selinux

(2)su - root                  提到root权限

(3)vi /etc/selinux/config      永久关闭setenforce


一.查看防火墙的状态命令

(1)systemctl status firewalld       查看当前的防火墙状态

防火墙开启状态

防火墙关闭状态

 二.暂时/永久关闭防火墙命令

(1)systemctl  stop firewalld         暂时关闭防火墙

重启系统,你会发现,防火墙又是开启状态

(2)systemctl  disable firewalld         永久关闭防火墙 (需要重新启动系统才能生效)

用reboot命令重启,防火墙就永久关闭了

三.临时/永久启动防火墙

(1)systemctl start firewalld        临时启动防火墙

重启系统之后,你就会发现还是关闭的。

(2)systemctl enable firewalld        永久启动防火墙(需要重新启动系统才能生效)

用reboot命令重启

(3)如果遇到不能重启,可能是firewalld服务被锁定了,可能是使用下面命令

systemctl unmask firewalld     解开firewalld的锁定

systemctl start firewalld.service

四.查看SELinux状态

(1)getenforce      查看当前SELinux状态

Enforcing——开启状态

Permissive——关闭状态

(2)cat  /etc/selinux/config      查看selinux的配置文件看状态

五.临时/永久关闭SELinux

(1)setenforce 0            临时禁用selinux

这是因为权限问题

(2)su - root                  提到root权限,在执行setenforce 0就可以了

(3)vi /etc/selinux/config      永久关闭setenforce

SELINUX=enforcing(开启)

SELINUX=disabled(关闭)

重启尝试就可以了

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值