Linux SELinux and iptables

1.關閉SELinux功能

第一種修改配置文件,永久生效:
[root@VM_0_7_centos ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


[root@VM_0_7_centos ~]# 
第二種臨時關閉,setenforce 0相當於disabled,1 相當於enforcing。
[root@VM_0_7_centos ~]# setenforce 0
[root@VM_0_7_centos ~]# getenforce 
Disabled

2.關閉防火墻 for CentOS 7

查看防火墻狀態,關閉,開啟
[root@VM_0_7_centos ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@VM_0_7_centos ~]# systemctl stop firewalld
[root@VM_0_7_centos ~]# systemctl start firewalld
[root@VM_0_7_centos ~]#

猜你喜欢

转载自blog.csdn.net/qq_40279031/article/details/84259340