1. 程式人生 > 其它 >centos7 防火牆 SELINUX

centos7 防火牆 SELINUX

技術標籤:centoslinuxselinux

  • 防火牆放開8080埠

[[email protected] bin]# cd ../logs/
[[email protected] logs]# cat catalina.out
。。。。。。
23-Jan-2021 16:34:52.374 資訊 [main] org.apache.coyote.AbstractProtocol.init 初始化協議處理器 ["http-nio-8080"]
。。。。。。
[[email protected] logs]#
[[email protected] logs]# firewall-cmd --add-port=8080/tcp --permanent
success
[
[email protected]
logs]# firewall-cmd --reload success [[email protected] logs]# firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: eth0 sources: services: dhcpv6-client http ssh ports: 80/tcp 8080/tcp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules: [
[email protected]
logs]#
  • 關閉防火牆 RHEL6以前為 Iptables,RHEL7 改為firewalld,

啟動服務:systemctl start firewalld.service
關閉服務:systemctl stop firewalld.service
重啟服務:systemctl restart firewalld.service
顯示服務狀態:systemctl status firewalld.service
開機時啟用:systemctl enable firewalld.service
開機時禁用:systemctl disable firewalld.service

檢視服務是否開機啟動:systemctl is-enabled firewalld.service;echo $?
檢視已啟動的服務列表:systemctl list-unit-files|grep enabled

  • 關閉selinux

1、檢視
[[email protected] ~]# getenforce
Disabled
[[email protected] ~]# /usr/sbin/sestatus -v
SELinux status: disabled
2、臨時關閉
##設定SELinux 成為permissive模式
##setenforce 1 設定SELinux 成為enforcing模式
setenforce 0
3、永久關閉
vi /etc/selinux/config
將SELINUX=enforcing改為SELINUX=disabled
設定後需要重啟才能生效