[RHEL7.1]關閉防火牆及SElinux

一、關閉防火牆

1. 先查看防火牆狀態

[root@bogon ~]#

systemctl status firewalld

firewalld.service - firewalld - dynamic firewall daemon

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

   Active: active (running) since 一 2015-05-25 22:53:54 CST; 3min 18s ago

 Main PID: 979 (firewalld)

   CGroup: /system.slice/firewalld.service

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

5月 25 22:53:54 localhost.localdomain systemd[1]: Started firewalld - dynami...

Hint: Some lines were ellipsized, use -l to show in full.

2. 關閉防火牆

[root@bogon ~]#

systemctl stop firewalld

[root@bogon ~]#

systemctl status firewalld

firewalld.service - firewalld - dynamic firewall daemon

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

   Active: inactive (dead) since 一 2015-05-25 23:03:56 CST; 3s ago

  Process: 979 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)

 Main PID: 979 (code=exited, status=0/SUCCESS)

5月 25 22:53:54 localhost.localdomain systemd[1]: Started firewalld - dynami...

5月 25 23:03:55 bogon systemd[1]: Stopping firewalld - dynamic firewall da.....

5月 25 23:03:56 bogon systemd[1]: Stopped firewalld - dynamic firewall daemon.

Hint: Some lines were ellipsized, use -l to show in full.

3. 查看防火牆服務是否開機啓動

[root@bogon ~]#

systemctl is-enabled firewalld

enabled  #開啓

4. 關閉防火牆開機啓動

[root@bogon ~]#

systemctl disable firewalld

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

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

[root@bogon ~]#

systemctl is-enabled firewalld

disabled



二、關閉SELinux

1. 查看當前SELinux狀態

[root@bogon ~]#

getenforce

Enforcing

2. 關閉SElinux

[root@bogon ~]#

setenforce 0

[root@bogon ~]# getenforce

Permissive

3. 編輯配置文件

[root@bogon ~]#

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章