CentOS 7.5 关闭SELINUX跟FIREWALL防火墙


含蓄笑白昼
含蓄笑白昼 2022-09-27 09:55:57 51802
分类专栏: 资讯

                CentOS 7.5关闭FireWall 和SELinux图文详解

1. 环境

CentOS 7.5 

2. 关闭FireWall和SELinux

2.1 FireWall

使用systemctl status firewalld查看防火墙的状态,如下(默认开启)

[linuxidc@localhost ~]$ systemctl status firewalld

// 防火墙状态
● firewalld.service - firewalld - dynamic firewall daemon
  Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
  Active: active (running) since 二 2018-11-13 14:40:53 CST; 11min ago
    Docs: man:firewalld(1)
 Main PID: 821 (firewalld)
    Tasks: 2
  CGroup: /system.slice/firewalld.service
          └─821 /usr/bin/Python -Es /usr/sbin/firewalld --nofork --nopid

11月 13 14:40:51 localhost.localdomain systemd[1]: Starting firewalld - dyna...
11月 13 14:40:53 localhost.localdomain systemd[1]: Started firewalld - dynam...
Hint: Some lines were ellipsized, use -l to show in full.

CentOS 7.5关闭FireWall 和SELinux图文详解

如果你需要使用FireWall服务(正式环境下),则需要修改它的配置,因为在默认情况下,它会拦截大多数服务请求。具体可以参考配置firewalld服务的基本操作和设置。

如果由于某些原因(比如本文只是需要Linux服务器来搭建某些服务,不想控制防火墙只开放某些端口)等而不需要FireWall服务,则可以像下面那样停止并禁用它。

// 关闭服务
[linuxidc@localhost ~]$ systemctl stop firewalld

// 关闭开机自动开启FireWall服务
[linuxidc@localhost ~]$ systemctl disable firewalld 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.Fedoraproject.FirewallD1.service.

 

2.2 关闭SELinux

可以用getenforce 查看SELinux的状态,如下(默认开启)

[linuxidc@localhost ~]$ getenforce

//开启状态
Enforcing

CentOS 7.5关闭FireWall 和SELinux图文详解

同上,如果你想使用SELinux也可以。但是本人不想那么麻烦,所以把SELinux也关闭了。

[linuxidc@localhost ~]$ sudo nano /etc/selinux/config

CentOS 7.5关闭FireWall 和SELinux图文详解

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 two values:
    targeted - Targeted processes are protected,
    minimum - Modification of targeted policy. Only selected processes are protected.
    mls - Multi Level Security protection.
SELINUXTYPE=targeted

CentOS 7.5关闭FireWall 和SELinux图文详解

// 重启使配置生效
[linuxidc@localhost ~] reboot

网站声明:如果转载,请联系本站管理员。否则一切后果自行承担。

本文链接:https://www.xckfsq.com/news/show.html?id=10615
赞同 0
评论 0 条
含蓄笑白昼L0
粉丝 0 发表 6 + 关注 私信
上周热门
如何使用 StarRocks 管理和优化数据湖中的数据?  2951
【软件正版化】软件正版化工作要点  2872
统信UOS试玩黑神话:悟空  2833
信刻光盘安全隔离与信息交换系统  2728
镜舟科技与中启乘数科技达成战略合作,共筑数据服务新生态  1261
grub引导程序无法找到指定设备和分区  1226
华为全联接大会2024丨软通动力分论坛精彩议程抢先看!  165
2024海洋能源产业融合发展论坛暨博览会同期活动-海洋能源与数字化智能化论坛成功举办  163
点击报名 | 京东2025校招进校行程预告  163
华为纯血鸿蒙正式版9月底见!但Mate 70的内情还得接着挖...  159
本周热议
我的信创开放社区兼职赚钱历程 40
今天你签到了吗? 27
如何玩转信创开放社区—从小白进阶到专家 15
信创开放社区邀请他人注册的具体步骤如下 15
方德桌面操作系统 14
用抖音玩法闯信创开放社区——用平台宣传企业产品服务 13
我有15积分有什么用? 13
如何让你先人一步获得悬赏问题信息?(创作者必看) 12
2024中国信创产业发展大会暨中国信息科技创新与应用博览会 9
中央国家机关政府采购中心:应当将CPU、操作系统符合安全可靠测评要求纳入采购需求 8

加入交流群

请使用微信扫一扫!