linux 防火牆和SELinux

一、防火牆

1.查看防火牆狀態

systemctl status firewalld

firewall-cmd --state #查看默認防火牆狀態(關閉後顯示notrunning,開啓後顯示running)

 

2.查看防火牆是否開機啓動

systemctl is-enabled firewalld

3.關閉防火牆

systemctl stop firewalld

systemctl stop firewalld.service

systemctl status firewalld

4.禁用防火牆(系統啓動時不啓動防火牆服務)

systemctl disable firewalld

systemctl disable firewalld.service

systemctl is-enabled firewalld

二、Selinux

查看SELinux狀態:

1、/usr/sbin/sestatus -v      ##如果SELinux status參數爲enabled即爲開啓狀態

SELinux status:                 enabled

2、getenforce                 ##也可以用這個命令檢查

關閉SELinux:

1、臨時關閉(不用重啓機器):

setenforce 0                  ##設置SELinux 成爲permissive模式

                              ##setenforce 1 設置SELinux 成爲enforcing模式

2、修改配置文件需要重啓機器:

修改/etc/selinux/config 文件

將SELINUX=enforcing改爲SELINUX=disabled

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