#查看系统防火墙的状态,可以看到防火墙是开着的
[root@bogon ~]#systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Sat 2017-06-03 09:38:00 CST; 8s ago
Docs: man:firewalld(1)
Main PID: 24067 (firewalld)
CGroup: /system.slice/firewalld.service
└─24067 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
Jun 03 09:37:58 bogon systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 03 09:38:00 bogon systemd[1]: Started firewalld - dynamic firewall daemon.
#关闭防火墙
[root@bogon ~]#systemctl stop firewalld
#再次查看防火墙,可以看到已经关闭了
[root@bogon ~]#systemctl status firewalld
● 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)
Jun 01 11:33:35 localhost systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 01 11:33:44 localhost systemd[1]: Started firewalld - dynamic firewall daemon.
Jun 03 09:11:32 bogon systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jun 03 09:11:34 bogon systemd[1]: Stopped firewalld - dynamic firewall daemon.
Jun 03 09:37:58 bogon systemd[1]: Starting firewalld - dynamic firewall daemon...
Jun 03 09:38:00 bogon systemd[1]: Started firewalld - dynamic firewall daemon.
Jun 03 09:38:34 bogon systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jun 03 09:38:36 bogon systemd[1]: Stopped firewalld - dynamic firewall daemon.
#查看selinux的运行模式,现在为强制模式
[root@bogon share]#getenforce
Enforcing
#把selinux设为许可模式
[root@bogon share]#setenforce 0
#再次查看selinux的运行模式,已经变为许可模式
[root@bogon share]#getenforce
Permissive
#要想禁用selinux,则需要编辑selinux的配置文件,把SELINUX设置成disabled,然后重启生效
[root@bogon share]#vi /etc/sysconfig/selinux
[root@bogon share]#cat /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are
protected
,
# minimum - Modification of targeted policy. Only selected processes are
protected
.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted