【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 ...
随机推荐
- sql表连接 —— join
一.内连接 —— INNER JOIN 内连接是最常见的一种连接,只连接匹配的行. 表1: 表2: 执行查询: select StudentId as 学生编号,StudentName as 姓名,G ...
- LeetCode63 Unique Paths II
题目: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. H ...
- 从零学React Native之03页面导航
之前我们介绍了RN相关的知识: 是时候了解React Native了 从零学React Native之01创建第一个程序 从零学React Native之02状态机 本篇主要介绍页面导航 上一篇文章给 ...
- BUAA 623 Chem is Try!
http://oj55.bianchengla.com/problem/623/ 好久没写过题解了,昨天做了一道挺恶心的题目,贴一下代码上来.看了一下提交状况,好像我的代码挺短的了,至少我找不到比我短 ...
- 宝塔linux
宝塔linux linux 定时任务管理
- Java排序算法总结
1.冒泡排序 冒泡排序是排序算法中最基本的一种排序方法,该方法逐次比较两个相邻数据的大小并交换位置来完成对数据排序,每次比较的结果都找出了这次比较中数据的最大项,因为是逐次比较,所以效率是O(N^2) ...
- 学习框架/对象onbeforeunload事件
1.有没有发现在一些表单提交页面,当我们点击页面某个链接要离开表单提交页面时会弹出一个提示信息,如下: 那么,这是提示是怎么产生的呢?代码如下: window.onbeforeunload=funct ...
- H3C 面向连接和无连接的服务
- Pytorch中多GPU训练指北
前言 在数据越来越多的时代,随着模型规模参数的增多,以及数据量的不断提升,使用多GPU去训练是不可避免的事情.Pytorch在0.4.0及以后的版本中已经提供了多GPU训练的方式,本文简单讲解下使用P ...
- 手把手教你用Python实现自动特征工程
任何参与过机器学习比赛的人,都能深深体会特征工程在构建机器学习模型中的重要性,它决定了你在比赛排行榜中的位置. 特征工程具有强大的潜力,但是手动操作是个缓慢且艰巨的过程.Prateek Joshi,是 ...