本文將簡單介紹在CentOS7上如何臨時和永久關閉防火牆和selinux。
關閉防火牆
# 查看防火牆狀態
[root@localhost ~]# systemctl status firewalld.service
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since 二 2019-03-26 19:21:11 CST; 3 weeks 0 days ago
Main PID: 907 (firewalld)
CGroup: /system.slice/firewalld.service
└─907 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
3月 26 19:21:10 localhost.localdomain systemd[1]: Starting firewalld - dynam...
3月 26 19:21:11 localhost.localdomain systemd[1]: Started firewalld - dynami...
Hint: Some lines were ellipsized, use -l to show in full.
# 臨時關閉防火牆
[root@localhost ~]# systemctl stop firewalld.service
# 禁止防火牆開機啟動,永久關閉
[root@localhost 桌面]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
關閉Selinux
查看selinux狀態
[root@localhost ~]# getenforce
Enforcing
臨時關閉selinux
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
永久關閉|禁止開機啟動
進入到/etc/selinux/config文件
vim /etc/selinux/config
將SELINUX=enforcing改為SELINUX=disabled,重啟生效。