全球主机交流论坛

标题: CentOS 7 怎么关闭防火墙 ? [打印本页]

作者: nic2013    时间: 2017-4-26 11:19
标题: CentOS 7 怎么关闭防火墙 ?

之前是用这2条命令关闭防火墙

  1. systemctl stop firewalld.service#停止firewall

  2. systemctl disable firewalld.service#禁止firewall开机启动
复制代码


刚刚新安装了一个 CentOS 7  ,运行这个命令提示 :

  1. [root@ccav ~]# systemctl stop firewalld.service
  2. Failed to stop firewalld.service: Unit firewalld.service not loaded.
  3. [root@ccav ~]# systemctl disable firewalld.service
  4. Failed to execute operation: Access denied
  5. [root@ccav ~]#
复制代码


我想改 SSH 端口,但是好像还是有防火墙存在。
作者: 图王    时间: 2017-4-26 11:22
service iptables stop
作者: 爱纯粹    时间: 2017-4-26 11:22
systemctl stop iptables
作者: coobar    时间: 2017-4-26 11:25
chkconfig iptables off  开机关闭
作者: nic2013    时间: 2017-4-26 11:25
图王 发表于 2017-4-26 11:22
service iptables stop

不行。

  1. [root@ccav ~]# service iptables stop
  2. Redirecting to /bin/systemctl stop  iptables.service
  3. Failed to stop iptables.service: Unit iptables.service not loaded.
  4. [root@ccav ~]#
复制代码


作者: nic2013    时间: 2017-4-26 11:27
coobar 发表于 2017-4-26 11:25
chkconfig iptables off  开机关闭

iptables 是 centos 6 的。


  1. [root@ccav ~]# chkconfig iptables off
  2. 服务 iptables 信息读取出错:没有那个文件或目录
  3. [root@ccav ~]#
复制代码

作者: 优秀的苦瓜    时间: 2017-4-26 11:39
提示: 作者被禁止或删除 内容自动屏蔽
作者: 我是人    时间: 2017-4-26 11:44
systemctl status firewalld出的什么?
作者: nic2013    时间: 2017-4-26 12:08
我是人 发表于 2017-4-26 11:44
systemctl status firewalld出的什么?

Unit firewalld.service could not be found.
作者: njav    时间: 2017-4-26 12:10
1、关闭防火墙:sudo systemctl stop firewalld.service
2、关闭开机启动:sudo systemctl disable firewalld.service

作者: nic2013    时间: 2017-4-26 12:11
优秀的苦瓜 发表于 2017-4-26 11:39
selinux

  1. [root@ccav ~]# getenforce
  2. Disabled
  3. [root@ccav ~]# sestatus -v
  4. SELinux status:                 disabled
  5. [root@ccav ~]#
复制代码

作者: nic2013    时间: 2017-4-26 12:30
njav 发表于 2017-4-26 12:10
1、关闭防火墙:sudo systemctl stop firewalld.service
2、关闭开机启动:sudo systemctl disable firewal ...
  1. [root@ccav ~]# sudo systemctl stop firewalld.service
  2. Failed to stop firewalld.service: Unit firewalld.service not loaded.
  3. [root@ccav ~]# sudo systemctl disable firewalld.service
  4. Failed to execute operation: No such file or directory
  5. [root@ccav ~]#
复制代码

作者: shenxiaofeng    时间: 2017-4-26 12:34
我平常是直接
systemctl disable firewalld
然后卸载
yum remove firewalld -y
作者: 我是人    时间: 2017-4-26 12:58
被玩坏了。。。

strace systemctl disable firewalld.service
作者: cgs3238    时间: 2017-4-26 14:36
那就是firewalld根本就没装,改端口连不上是因为SeLinux的限制,把它disabled或者改下限制端口
作者: aboutyj    时间: 2017-4-26 14:52
目测是1511版本的centos7,1511版本的centos7居然默认没有装firewall的,自己关闭selinux,改ssh端口即可
作者: andyli    时间: 2017-4-26 14:52
查看防火墙: firewall-cmd --version  看看有没有安装
systemctl restart firewalld.service 即可



作者: nic2013    时间: 2017-4-26 14:53
aboutyj 发表于 2017-4-26 14:52
目测是1511版本的centos7,1511版本的centos7居然默认没有装firewall的,自己关闭selinux,改ssh端口即可 ...

默认是 关闭 selinux 的。
作者: cgs3238    时间: 2017-4-26 14:57
难道用的是某某云?需要到管理后台增加防火墙规则




欢迎光临 全球主机交流论坛 (https://hostloc.gdisk.cf/) Powered by Discuz! X3.4