firewalld won't close a port? [SOLVED}

General support questions
Post Reply
jeffw_00
Posts: 60
Joined: 2006/12/17 02:55:29

firewalld won't close a port? [SOLVED}

Post by jeffw_00 » 2017/12/16 18:04:54

Hi - I opened a port for ftp but on further thought I want to undo what I did close it. I tried

firewall-cmd --zone=public --remove-port=21/tcp --permanent
firewall-cmd --runtime-to-permanent
firewall-cmd --reload

For the first command, I also tried

firewall-cmd --zone=public --service=ftp --remove-port=21/tcp --permanent

But I stll get...

# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: enp1s0
sources:
services: ssh dhcpv6-client ftp
ports: 21/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:

What am I doing wrong?

Thanks /j
Last edited by jeffw_00 on 2017/12/17 20:04:08, edited 1 time in total.

jeffw_00
Posts: 60
Joined: 2006/12/17 02:55:29

Re: firewalld won't close a port?

Post by jeffw_00 » 2017/12/16 21:12:38

First, the correct sequence is

firewall-cmd --zone=public --remove-port=21/tcp --permanent
firewall-cmd --reload
(otherwise 2nd command wipes effect of first)

Second - answer is to keep it simple

firewall-cmd --remove-port=21/tcp --permanent
firewall-cmd --reload

ftp is a built-in service so can't remove it.
/j

Post Reply