龙空技术网

CentOS6.5防火墙

学海无涯努力 164

前言:

现时咱们对“centos禁用root登录”大概比较关注,兄弟们都想要知道一些“centos禁用root登录”的相关资讯。那么小编在网摘上汇集了一些对于“centos禁用root登录””的相关内容,希望小伙伴们能喜欢,朋友们快快来了解一下吧!

CentOS6.5查看防火墙的状态:

service iptable status

Redirecting to /bin/systemctl status iptable.service

iptable.service

Loaded: not-found (Reason: No such file or directory)

Active: inactive (dead) --表示防火墙已经关闭

CentOS 6.5关闭防火墙

[root@localhost ~]#servcie iptables stop --临时关闭防火墙

[root@localhost ~]#chkconfig iptables off --永久关闭防火墙

CentOS 7.2关闭防火墙

CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。

firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

firewall-cmd --state

not running

检查防火墙的状态:

从centos7开始使用systemctl来管理服务和程序,包括了service和chkconfig。

systemctl list-unit-files|grep firewalld.service --防火墙处于关闭状态

firewalld.service disabled

关闭防火墙:

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

systemctl stop firewalld.service

systemctl disable firewalld.service

启动一个服务:systemctl start firewalld.service

关闭一个服务:systemctl stop firewalld.service

重启一个服务:systemctl restart firewalld.service

显示一个服务的状态:systemctl status firewalld.service

在开机时启用一个服务:systemctl enable firewalld.service

在开机时禁用一个服务:systemctl disable firewalld.service

查看服务是否开机启动:systemctl is-enabled firewalld.service;echo $?

查看已启动的服务列表:systemctl list-unit-files|grep enabled

关闭防火墙

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

开启: chkconfig iptables on

关闭: chkconfig iptables off

2) 即时生效,重启后复原

开启: service iptables start

关闭: service iptables stop

查看防火墙状态: service iptables status

下面说下CentOS7和6的默认防火墙的区别

CentOS 7默认使用的是firewall作为防火墙,使用iptables必须重新设置一下

1、直接关闭防火墙2、设置 iptables service

如果要修改防火墙配置,如增加防火墙端口3306

systemctl stop firewalld.service #停止firewall

systemctl disable firewalld.service #禁止firewall开机启动

标签: #centos禁用root登录