TCP · Port 21IANA Registered

Port 21 — FTP (Control)

File Transfer Protocol control channel, used to establish sessions, authenticate credentials, and issue navigation commands.

⚡ Primary Use Cases & Environments

  • ✓Legacy web hosting file uploads
  • ✓Network-attached storage (NAS) administration

🛡️ Security & Vulnerability Analysis

Usernames and passwords sent over port 21 are completely unencrypted. Anyone sniffing the network can capture admin credentials in plaintext.

🔧 Network Diagnostics & Inspection

1. Check Active Listening Sockets (Local Host)
Terminal Command
$ sudo ss -tuln | grep :21
Inspects whether any local process daemon is bound to port 21.
2. Remote Port & Service Scan (Nmap)
Terminal Command
$ nmap -p 21 -sV --script ftp-anon <target-ip>
Probes target IP to determine whether port 21 is open, closed, or filtered.
3. Wireshark Capture / Display Filter
tcp.port == 21Wireshark Filter

🔥 Firewall Configuration Rules (UFW & iptables)

UFW (Uncomplicated Firewall)
Terminal Command
$ sudo ufw allow 21/tcp
Applies a persistent Linux UFW firewall rule for port 21.
iptables Command
Terminal Command
$ sudo iptables -A INPUT -p tcp --dport 21 -j ACCEPT
Appends a direct netfilter kernel rule to the INPUT chain for port 21.

❓ Frequently Asked Questions (FAQ)

What is the difference between port 21 and port 22?

Port 21 is unencrypted legacy FTP. Port 22 is SSH / SFTP, which encrypts authentication, terminal sessions, and file transfers using strong public-key cryptography.

How do I test if FTP port 21 is open?

Run "nc -zv <target-ip> 21" or "telnet <target-ip> 21". If open, the server returns an FTP banner such as "220 Service Ready".

Related Networking Tools & Guides