1. 程式人生 > >Red Hat Enterprise Linux 7關閉防火墻及SElinux

Red Hat Enterprise Linux 7關閉防火墻及SElinux

selinux firewalld

Red Hat Enterprise Linux 7關閉防火墻及SElinux

一、關閉防火墻

1. 先查看防火墻狀態

[[email protected] ~]#systemctl status firewalld

firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled)

Active: active (running) since 三 2017-10-11 15:31:32 CST; 2min 20s ago

Main PID: 809 (firewalld)

CGroup: /system.slice/firewalld.service

└─809 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

10月 11 15:32:32 db1 systemd[1]: Started firewalld - dynamic firewall daemon.


2. 關閉防火墻

[[email protected] ~]#systemctl stop firewalld

[[email protected] 桌面]# systemctl status firewalld

firewalld.service - firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)

Active: inactive (dead)


10月 11 23:31:18 db1 systemd[1]: Starting firewalld - dynamic firewall dae.....

10月 11 15:31:32 db1 systemd[1]: Started firewalld - dynamic firewall daemon.

10月 11 15:34:54 db1 systemd[1]: Stopping firewalld - dynamic firewall dae.....

10月 11 15:34:55 db1 systemd[1]: Stopped firewalld - dynamic firewall daemon.


3. 查看防火墻服務是否開機啟動

[[email protected] ~]#systemctl is-enabled firewalld

enabled #開啟


4. 關閉防火墻開機啟動

[[email protected] ~]#systemctl disable firewalld

rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service‘

rm ‘/etc/systemd/system/basic.target.wants/firewalld.service‘

[[email protected] ~]#systemctl is-enabled firewalld

disabled


二、關閉SELinux

1. 查看當前SELinux狀態

[[email protected] ~]#getenforce

Enforcing


2. 關閉SElinux

[[email protected] ~]# getenforce 0

[[email protected] ~]# getenforce

Permissive


3. 編輯配置文件

[[email protected] ~]#vim /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=permissive #修改此參數

# 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


本文出自 “花之旭的博客” 博客,請務必保留此出處http://huazhixu123.blog.51cto.com/1591874/1971452

Red Hat Enterprise Linux 7關閉防火墻及SElinux