Linux Firewall 開啟與關閉 以及sudo 設置


Linux 系統下,普通用戶經常需要使用root 用戶的權限,所以要經常切換到root用戶,比較麻煩,因此可以給普通用戶添加root 權限,需要在常規命令前面加上sudo

切換到root

vi  /etc/sudoers

首行添加:

用戶名 ALL = (root)NOPASSWD:ALL

 

查看防火牆狀態:

sudo service iptables status

centsos 7用法:

sudo systemctl status firewalld  看到active(running)就意味着防火牆打開了。

啟動防火牆:

sudo service iptables start

centsos 7用法:

sudo systemctl start firewalld (重啟之后防火牆會恢復到原來的狀態)

sudo systemctl enable firewalld (重啟之后防火牆會開啟,需要重啟才會生效)

重啟防火牆

sudo service iptables restart

關閉防護牆

sudo service iptables stop

永久性設置防火牆關閉|開啟

sudo chkconfig iptables off|on

centsos 7用法:

sudo systemctl stop firewalld (重啟之后防火牆會恢復到原來的狀態)

sudo systemctl disable firewalld (重啟之后防火牆會關閉,需要重啟才會生效)

 

selinux的關閉

sudo vi /etc/sysconfig/selinux

SELINUX = disabled

然后重啟sudo reboot

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM