Linux下防火墻和selinux的啟動、關(guān)閉和查看-創(chuàng)新互聯(lián)

CentOS7.X下:

1.防火墻

防火墻狀態(tài)查看:
[root@localhost sunan]# systemctl status firewalld.service
● 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)

其中Active為inactive (dead)為關(guān)閉狀態(tài),active (running)為開啟狀態(tài)

成都創(chuàng)新互聯(lián)公司是一家專業(yè)從事做網(wǎng)站、成都網(wǎng)站設(shè)計的網(wǎng)絡(luò)公司。作為專業(yè)的建站公司,成都創(chuàng)新互聯(lián)公司依托的技術(shù)實力、以及多年的網(wǎng)站運營經(jīng)驗,為您提供專業(yè)的成都網(wǎng)站建設(shè)、成都全網(wǎng)營銷及網(wǎng)站設(shè)計開發(fā)服務(wù)!
關(guān)閉防火墻命令:
[root@localhost sunan]# systemctl stop firewalld.service
開啟防火墻命令:
[root@localhost sunan]# systemctl start firewalld.service
永久禁用防火墻命令(開機不自啟動)
[root@localhost sunan]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
永久啟動防火墻命令(開機自啟動)
[root@localhost sunan]# systemctl enable firewalld.service   
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.

CentOS6.X下:

1.防火墻

防火墻狀態(tài)查看:
[root@localhost ~]# service iptables status
關(guān)閉防火墻命令:
[root@localhost ~]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
開啟防火墻命令:
[root@localhost ~]# service iptables start
iptables: Applying firewall rules:                         [  OK  ]
永久禁用防火墻命令(開機不自啟動)
[root@localhost ~]# chkconfig iptables off
永久啟動防火墻命令(開機自啟動)

[root@localhost ~]# chkconfig iptables on

2.selinux(CentOS7.X同CentOS6.X)

查看selinux狀態(tài):
[root@localhost sunan]# getenforce 
Enforcing

selinux狀態(tài)有三種模式:
enforcing:強制模式,代表selinux運行中,且已經(jīng)正確的開始限制domain/type了。
permissive:寬容模式,代表selinux運作中,不過僅會有警告信息并不會實際限制domain/type的訪問。這種模式可以用來作為selinux的debug之用
disabled:關(guān)閉,selinux沒有實際運行。
命令設(shè)置SELinux,前提不能是disabled狀態(tài):

[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce  
Permissive

其中setenforce 0|1
0:設(shè)置為premissive狀態(tài);
1:設(shè)置為enforcing狀態(tài);
此設(shè)置:重啟系統(tǒng)后無效。
修改配置文件,設(shè)置selinux為disabled狀態(tài):

[root@localhost ~]# vim /etc/selinux/config

SELINUX=disabled
SELINUXTYPE=targeted

保存,重啟系統(tǒng)生效。

另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。

網(wǎng)站標題:Linux下防火墻和selinux的啟動、關(guān)閉和查看-創(chuàng)新互聯(lián)
瀏覽路徑:http://muchs.cn/article6/djgeog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站營銷、虛擬主機、移動網(wǎng)站建設(shè)、響應(yīng)式網(wǎng)站、ChatGPT、Google

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務(wù)器托管