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

原文地址:https://www.cnblogs.com/pickKnow/p/10670882.html