【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 ...
随机推荐
- laravel 自定义常量方法
laravel 自定义常量方法 版本5以上验证OK 常量定义方案A: step1 按路径生成constants文件app/config/constants.php step2 constants文件里 ...
- Python 常量
- HDU-1029_Ignatius and the Princess IV
Ignatius and the Princess IV Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32767 K (Jav ...
- @codeforces - 1056G@ Take Metro
目录 @description@ @solution@ @accepted code@ @details@ @description@ 环上有 n 个点,按顺时针顺序以 1 到 n 编号.其中 1~m ...
- Hbase架构与实现
- iOS开发那些事-响应内存警告
好的应用应该在系统内存警告情况下释放一些可以重新创建的资源.在iOS中我们可以在应用程序委托对象.视图控制器以及其它类中获得系统内存警告消息. 1.应用程序委托对象 在应用程序委托对象中接收内存警告消 ...
- 命名分组(?<name>....)
捕获组分为: 普通捕获组(Expression) 命名捕获组(?Expression) 普通捕获组 从正则表达式左侧开始,每出现一个左括号"("记做一个分组,分组编号从 1 开始. ...
- ThinkPHP商城实战
ThinkPHP3.2.3商城实战教程,需要的联系我,QQ:1844912514 千万级php电商秒杀项目实战 ,需要的联系我,QQ:1844912514
- 自动为DEV GridView控件添加SizeChanged事件
实现gdv设置的抽象对象,不用每个gdv控件都添加sizechanged事件,只需执行gdc绑定sql函数,在其中会自动添加SizeChanged事件. //2016.5.13 by sngk //根 ...
- Python--day65--模板语言之tags
Tags for循环 普通for循环 <ul> {% for user in user_list %} <li>{{ user.name }}</li> {% en ...