Linux关闭防火墙
查看防火墙状态
注:systemctl是CentOS7以上的命令,service是CentOS6以下的
[root@localhost ~]# systemctl status firewalld
[root@localhost ~]# service iptables status
暂时关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# service iptables stop
永久关闭防火墙
[root@localhost ~]# systemctl disable firewalld
[root@localhost ~]# service iptables off
重启防火墙
[root@localhost ~]# systemctl enabled firewalld
[root@localhost ~]# service iptables restart
关闭SElinux
查看SElinux状态 – /usr/sbin/sestatus
如果SELinux status参数为enabled即为开启状态
[root@localhost ~]# /usr/sbin/sestatus -v
查看SElinux状态 – getenforce
也可以用这个命令检查,Enforcing为开启
[root@localhost ~]# getenforce
临时关闭SElinux
[root@localhost ~]# setenforce 0 # 设置SELinux 成为临时关闭模式
[root@localhost ~]# setenforce 1 # setenforce 1 设置SELinux 成为enforcing模式
永久关闭SElinux – 修改配置文件重启机器
- 修改/etc/selinux/config 文件
- 将SELINUX=enforcing改为SELINUX=disabled
- 重启机器即可