Linux导航界面,何实现这样的页面内导航

CentOS 6/7关闭防火墙和SELinux

[TOC]

CentOS 7之后默认使用的是firewall作为防火墙,如果切换到iptables首先应该关掉默认的firewalld,然后安装iptables服务。

一、CentOS7中关闭防火墙firewalld

1、临时关闭(下次开机启动,自动启动防火墙)[root@localhost ~]# systemctl stop firewalld

2、查看防火墙状态#查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

[root@localhost ~ ]# firewall-cmd --state

running

绿的Active: active (running)

表示防火墙开启

[root@localhost test]# 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 三 2020-09-23 17:36:45 CST; 5h 36min ago

Docs: man:firewalld(1)

Main PID: 875 (firewalld)

Tasks: 2

CGroup: /system.slice/firewalld.service

└─875 /usr/bin/python2 -Es /usr/sbin/firewalld --nofork --nopid

9月 23 17:36:43 localhost.localdomain systemd[1]: Starting firewalld - dynami...

9月 23 17:36:45 localhost.localdomain systemd[1]: Started firewalld - dynamic...

Hint: Some lines were ellipsized, use -l to show in full.

3、永久关闭防火墙(开机启动时不在启动)[root@localhost ~]# systemctl disable firewalld

4、永久开启防火墙[root@localhost ~]# systemctl enable firewalld.service

二、CentOS6中关闭防火墙Iptables

1、永久性生效,重启后不会复原

开启:chkconfig iptables on

关闭:chkconfig iptables off

2、临时关闭service iptables stop #停止iptables

3、临时开启service iptables start

三、关闭SElinux

1、查看selinux状态#permissive模式是临时关闭,enforcing模式是临时打开,disabled模式是永久关闭

[root@localhost ~]# getenforce

Enforcing         表示启动

#如果SELinux status参数为enabled即为开启状态

[root@localhost test]# /usr/sbin/sestatus -v

SELinux status: enabled

2、临时关闭

临时打开SELinux setenforce 1[root@localhost ~]# setenforce

usage:  setenforce [ Enforcing | Permissive | 1 | 0 ]     1表示启动,0表示关闭

[root@localhost ~]# setenforce 0                          临时关闭

[root@localhost ~]# getenforce                            查看状态

Permissive                                                关闭状态

3、永久关闭(修改配置文件,即可永久关闭)永久关闭SELinux:设置为disabled

永久打开SELinux:设置为enabled[root@localhost ~]# vi /etc/selinux/config

# 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.

SELINUX=enforcing         修改为"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

四、查看防火墙状态及开启关闭命令 存在以下两种方式一、service方式

查看防火墙状态:service iptables status

iptables:未运行防火墙。

开启防火墙: service iptables start

关闭防火墙: service iptables stop

二、iptables方式

先进入init.d目录,命令如下:

[root@centos6 ~]# cd /etc/init.d/

[root@centos6 init.d]#

然后

查看防火墙状态:

[root@centos6 init.d]# /etc/init.d/iptables status

暂时关闭防火墙:

[root@centos6 init.d]# /etc/init.d/iptables stop

重启iptables:

[root@centos6 init.d]# /etc/init.d/iptables restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值