Linux(CentOS7) 关闭防火墙、放开端口以及关闭Selinux

谁借莪1个温暖的怀抱¢ 2021-12-20 00:19 474阅读 0赞

1、 关闭防火墙并设置开机不启动

查看当前状态

[root@xuegod63 ~]# systemctl status firewalld.service #**查看firewalld状态**

[root@xuegod63 ~]# systemctl stop firewalld #**关闭**

[root@xuegod63 ~]# systemctl start firewalld #**开启**

[root@xuegod63 ~]# systemctl disable firewalld #**开机自动关闭 //RHLE7**

[root@xuegod63 ~]# chkconfig —list|grep network #**查看开机是否启动 //RHLE6**

[root@xuegod63 ~]# systemctl enable firewalld #**开机自动启动**

2.、放开端口(设置防火墙)

  1. firewall-cmd --add-port=3306/tcp --permanent
  2. firewall-cmd --reload

查看当前开放的端口

  1. firewall-cmd --zone=public --list-ports

3、 临时和永久关闭Selinux

临时关闭

[root@xuegod63 ~]# getenforce

Enforcing

[root@xuegod63 ~]# setenforce 0

setenforce: SELinux is disabled

永久关闭

[root@xuegod63 ~]# vim /etc/selinux/config

改:7 SELINUX=enforcing #前面的7,表示文档中第7行。方便你查找

为:7 SELINUX=disabled

[root@xuegod63 ~]# reboot #**重启主机**

发表评论

表情:
评论列表 (有 0 条评论,474人围观)

还没有评论,来说两句吧...

相关阅读