ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

关闭centos 7防火墙和selinux方法

2020-12-16 18:04:25  阅读:232  来源: 互联网

标签:centos service selinux 防火墙 firewalld 关闭 localhost


关闭防火墙

转载自:https://blog.csdn.net/shawCloud/article/details/90240712

在Centos7中查看当前系统的防火墙命令

  • 查看当前防火墙状态

第一种方式

[root@localhost /]# firewall-cmd --state
running

第二种方式(如果防火墙处于开启状态,firewalld.service前面的点是高亮的,Active:active(开启),推荐此种方式)

[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: inactive (dead)
Docs: man:firewalld(1)

关闭当前的防火墙(仅对本次开机有效,重启后防火墙会再次启用)

[root@localhost /]# systemctl stop firewalld.service

  • 永久关闭防火墙(重启后防火墙依然关闭)

[root@localhost /]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

 

关闭SElinux

转载自:https://blog.csdn.net/zhoushengtao12/article/details/95346903

1、为什么要关闭selinux

初学者配置linux服务器时不成功,却没有头绪,那是因为在linux操作系统中默认开启了防火墙,SELinux也处于启动状态,一般状态为enforing。致使很多服务端口默认是关闭的。所以好多服务初学者明明配置文件正确,等验证时有时连ping也ping不通。建议初学者在未学到SELlinux与iptables之前,配置服务器把这两项都关掉。

2、查看selinux状态

#getenforce
enforcing为开启、disable为关闭:

 

 

3、临时关闭selinux

#setenforce 0

4、永久关闭selinux

#vi /etc/selinux/config
#SELINUX=enforcing改为SELINUX=disabled
重启生效

5、永久开启

与四相反

标签:centos,service,selinux,防火墙,firewalld,关闭,localhost
来源: https://www.cnblogs.com/black-king/p/14145310.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有