CentOS / RHEL Open FTP Port 21 with firewalld
In this guide, I’m going to show how to open FTP port 21 with firewalld in CentOS / RHEL. Let’s start:
Table of Contents
- Check firewalld Status
- Check Active Zones
- Open Port 21 in Public Zone
- Check Services & Ports List
- Remove FTP Port 21
Step 1 : Check firewalld Status
First, let’s check the firewalld’s status:
Response:
running
Step : Check Active Zones
We can open 21 ports in any available zone.
Response:
public
interfaces: eth0
Step 3: Open Port 21 in Public Zone
In my test server, there is only one zone available called public. Normally all server has this public zone and most of the users choose a public zone to open port. Let’s open 21 ports in public zone:
o add temporarily, we have to run this command:
To add permanently, we have to run this command:
After adding port, we need to reload
firewalld:
Step 4: Check Services & Ports List
Now we can verify the running port and services of our server. To see the list, we need to run this command:
Response:
public (active)
target: default
icmp-block-inversion: no
interfaces: eth0
sources:
services: ssh dhcpv6-client ftp http https
ports: 21/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
Step 5: Remove FTP Port 21
If we need to remove the FTP port, we can do it easily:
After removing the port, again we need to reload
the firewalld:
That’s all. Thanks for reading. ?