centOS7 Linux 防火墙和SELinux的开启和关闭

防火墙(firewalld)

临时关闭防火墙 

systemctl stop firewalld

永久防火墙开机自关闭 

systemctl disable firewalld

临时打开防火墙 

systemctl start firewalld

防火墙开机启动 

systemctl enable firewalld

查看防火墙状态 

systemctl status firewalld

[root@localhost ~]# systemctl status firewalld

● firewalld.service- firewalld - dynamic firewall daemon

Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: ena bled)

Active: active (running) since Sat2017-04-0810:36:57CST; 31s ago

Main PID:2856(firewalld)

CGroup: /system.slice/firewalld.service

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

Apr0810:36:56localhost.localdomainsystemd[1]: Starting firewalld - dynamic firewal....

Apr0810:36:57localhost.localdomainsystemd[1]: Started firewalld - dynamic firewall....

Hint:Some lines were ellipsized, use -l to showinfull.

[root@localhost ~]#

SELinux

临时关闭SELinux 

setenforce 0

临时打开SELinux 

setenforce 1

查看SELinux状态 

getenforce

开机关闭SELinux 

编辑/etc/selinux/config文件,如下图,将SELINUX的值设置为disabled。下次开机SELinux就不会启动了。 

注意,此时也不能通过setenforce 1命令临时打开。

[root@localhost~]# setenforce 1setenforce: SELinuxisdisabled

1

2

需要修改配置文件,然后重启linux后,才可以再打开SELinux

你可能感兴趣的:(centOS7 Linux 防火墙和SELinux的开启和关闭)