linux 关闭防火墙firewall,centos中关闭防火墙(firewall)及SELinux

https://blog.csdn.net/weixin_30983965/article/details/116864967

centos在不断的版本更新迭代过程中,在centos7中默认使用的是firewall作为防火墙。

centos7关闭firewall

查看运行状态:firewall-cmd --state

临时停止:systemctl stop firewalld.service

启动:systemctl start firewalld.service

禁止防火墙开机启动,永久关闭:systemctl disable firewalld.service

centos6 关闭iptables

安装:yum install -y iptables-services

如果centos7也安装了iptables-services,也可以使用以下命令来关闭防火墙

1) 即时生效,重启后复原

开启: service iptables start

关闭: service iptables stop

状态: service iptables status

2) 永久性生效,重启后不会复原

开启: chkconfig iptables on

关闭: chkconfig iptables off

3)正确关闭步骤:

service iptables stop

chkconfig iptables off

SELinux关闭

查看命令1:getenforce

查看命令2:/usr/sbin/sestatus -v

当返回结果为Disabled时,为关闭状态

临时关闭:setenforce 0

永久关闭:vim /etc/selinux/config

将SELINUX=enforcing更改为SELINUX=disabled

设置后需要重启机器后才能生效。

posted on 2023-01-12 10:59  四海骄阳  阅读(121)  评论(0)    收藏  举报

导航