【E20200101-1】Centos 7.x 关闭防火墙(firewall)和SELinux
一、准备工作
1.1、服务器准备
操作系统:centos 7.x
1.2、安装好用的文本编辑工具nano
# yum -y install nano
二、关闭SELinux
2.1、查看SELinux状态
2.1.1、第一种:查看SELinux状态方法
# /usr/sbin/sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
2.1.2、第二种:查看SELinux状态方法
# getenforce
Enforcing
2.2、临时关闭SELinux
# setenforce 0
2.2.1、临时关闭后第一种方法查看SELinux状态
# /usr/sbin/sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive //注意这里是 permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
2.2.2、临时关闭后第二种方法查看SELinux状态
# getenforce
Permissive
2.2.3、临时关闭后可以再次打开SELinux
# setenforce 1
2.3、永久关闭SELinux
2.3.1、修改配置文件/etc/sysconfig/selinux
# nano /etc/sysconfig/selinux
selinux=enforcing 改为 selinux=disabled
# 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.
# ↓↓↓↓这里修改成disabled
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
2.3.2、重启后新配置生效
# reboot
2.3.3、临时关闭后第一种方法查看SELinux状态
# /usr/sbin/sestatus
SELinux status: disabled
2.3.4、临时关闭后第二种方法查看SELinux状态
# getenforce
Disabled
三、关闭防火墙firewall
3.1、查看防火墙状态
# systemctl status firewalld
防火墙开启状态下显示如下
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
//这行是我添加的备注↓↓↓注意这里的 active (running)
Active: active (running) since Wed 2020-01-01 17:05:47 CST; 9s ago
Docs: man:firewalld(1)
Main PID: 6787 (firewalld)
CGroup: /system.slice/firewalld.service
└─6787 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid
Jan 01 17:05:47 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 01 17:05:47 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Started firewalld - dynamic firewall daemon.
3.2、关闭防火墙
# systemctl stop firewalld
3.3、关闭后查看状态
# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
Jan 01 17:05:47 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 01 17:05:47 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Started firewalld - dynamic firewall daemon.
Jan 01 17:11:58 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jan 01 17:11:58 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Stopped firewalld - dynamic firewall daemon.
3.4、关闭防火墙开机自启动
# systemctl disable firewalld.service
3.5、关闭防火墙开机自启动后查看防火墙状态
# 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)
Jan 01 17:05:47 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Starting firewalld - dynamic firewall daemon...
Jan 01 17:05:47 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Started firewalld - dynamic firewall daemon.
Jan 01 17:11:58 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Stopping firewalld - dynamic firewall daemon...
Jan 01 17:11:58 iZuf65lq1u9ra1ohnf5kebZ systemd[1]: Stopped firewalld - dynamic firewall daemon.
Eword 原创学习笔记
文档编号:E20200101-1
文档标签:Centos、防火墙、firewall、SELinux
转载请注明出处:http://www.eword.name
【E20200101-1】Centos 7.x 关闭防火墙(firewall)和SELinux的更多相关文章
- centOS 6.5关闭防火墙步骤
centOS 6.5关闭防火墙步骤 关闭命令: service iptables stop 永久关闭防火墙:chkconfig iptables off 两个命令同时运行,运行完成后 ...
- CentOS 7.2 关闭防火墙
CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之前的版本使用iptables不一样 1.关闭防火墙: systemctl stop f ...
- CentOS开启和关闭防火墙
CentOS Linux开启和关闭防火墙命令有两种,一种是临时的,重启即复原:另外一种是永久性的,重启不会复原. 1) 临时生效,重启后复原 开启: service iptables start ...
- centos 7.X关闭防火墙和selinux
一.关闭防火墙 centos从7开始默认用的是firewalld,这个是基于iptables的,虽然有iptables的核心,但是iptables的服务是没安装的. 所以你只要停止firewalld服 ...
- Linux下Centos 7如何关闭防火墙?
Linux下的防火墙有两种:Iptables和Firewall(概念以及区别大家可以自行搜索).为什么要关闭防火墙呢?主要是我们都过Linux搭建服务器的时候其他机器访问会被墙掉,例如:Tomcat, ...
- CentOS 6.5关闭防火墙
关闭命令: service iptables stop 永久关闭防火墙:chkconfig iptables off 两个命令同时运行,运行完成后查看防火墙关闭状态 service iptables ...
- centos 6.5 关闭防火墙
关闭防火墙分为临时关闭和永久关闭.临时关闭重启系统后恢复正常,永久关闭重启系统后仍然是关闭状态 临时关闭与开启 service iptables stop service iptables start ...
- centos 8.3关闭防火墙,设置开机启动禁用防火墙
关闭防火墙 [root@bogon ~]# systemctl stop firewalld 开机禁用防火墙 [root@bogon ~]# systemctl disable firewa ...
- CentOS 7.0关闭默认firewall防火墙启用iptables防火墙
操作系统环境:CentOS Linux release 7.0.1406(Core) 64位CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭f ...
随机推荐
- seleium 滑动到底部
def scroll(driver): driver.execute_script(""" (function () { var y = document.body.sc ...
- python == 符号
- 1月房地产企业销售TOP100出炉 万科重回第一
1月房地产企业销售TOP100出炉 万科重回第一 2017-02-05 07:40:32 来源:腾讯新闻 责任编辑: [摘要]TOP100房企1月的销售金额合计4311.8亿元,销售面积合计3648. ...
- ImportError: No module named tensorflow.compat.v1 忽略已经安装的某个包版本 忽略已安装版本
ImportError: No module named tensorflow.compat.v1 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声 ...
- 从遇见到信任 | Apache Dubbo 的毕业之旅
所谓信任,就是多一次机会. 2018年2月16日,Apache Dubbo 加入 Apache 基金会孵化器. ... 2019年5月16日,Apache 软件基金会董事会决议通过了 Apache D ...
- PHP 7.0新增特性详解
https://www.cnblogs.com/riverdubu/archive/2017/03/22/6434705.html 开始介绍PHP7.0新特性,具体的可以参照官网的介绍,我来挑一些给大 ...
- 出现 java.net.ConnectException: Connection refused 异常的原因及解决方法
1 异常描述 在启动 Tomcat 服务器的时候,控制台一直输出异常信息,然后停止服务器,报出如下异常: 2 异常原因 通过观察上图中被标记出来的异常信息,咱们可以知道 java.net.Connec ...
- 洛谷 3177 [HAOI2015] 树上染色
题目描述 有一棵点数为 N 的树,树边有边权.给你一个在 0~ N 之内的正整数 K ,你要在这棵树中选择 K个点,将其染成黑色,并将其他 的N-K个点染成白色 . 将所有点染色后,你会获得黑点两两之 ...
- java接口的使用
格式:public class SubImpl extends Super implements IA,IB 接口可以多继承,但是只能继承接口,不能继承类. 实现接口(支持多实现) [修饰符] c ...
- 走过的laravel-admin 的坑
一.http://laravel-admin.org/docs/#/zh/ 大家可以根据这个安装1.5 版本的laravel后台管理, 他很方便哦,有很多方法他都自己自己封装了. 二.大家如果想好好 ...