Toolman

Port 21 — FTP control

TCP well-known

What runs on port 21

The command channel for FTP: login, directory listings and transfer commands.

Security considerations

Credentials travel in clear text. Anything exposed to the internet on port 21 will be found by scanners within hours.

Checking whether something is listening

# Linux / macOS — what is bound to the port
sudo lsof -i :21
sudo ss -lntp | grep :21

# Windows
netstat -ano | findstr :21
Get-NetTCPConnection -LocalPort 21

# is it reachable from outside?
nc -zv example.com 21
curl -v telnet://example.com:21

Freeing the port

# find the process, then stop it
sudo lsof -ti :21 | xargs kill        # Linux / macOS
netstat -ano | findstr :21            # note the PID, then:
taskkill /PID <pid> /F                    # Windows

Should this port be open to the internet?

Usually not. Expose it only if a specific external client needs it, and restrict by source address where you can.

Quick reference

Port21
ProtocolTCP
ServiceFTP control
RangeWell-known (0–1023) — binding requires root on Unix

Frequently asked questions

What is port 21 used for?

The command channel for FTP: login, directory listings and transfer commands.

Is it safe to open port 21?

Credentials travel in clear text. Anything exposed to the internet on port 21 will be found by scanners within hours.

How do I check if port 21 is open?

Locally, sudo lsof -i :21 on macOS or Linux, or netstat -ano | findstr :21 on Windows. From outside, nc -zv host 21 tells you whether anything answers.

Why do I get "address already in use" on port 21?

Another process is bound to it — often a previous run of your own program that did not exit cleanly. Find it with lsof -ti :21 and stop it, or configure your application to use a different port.

Can I change the port this service uses?

Almost always yes, in the service's configuration. Moving off a default port reduces automated scan noise, but it is obfuscation rather than security — a real attacker scans all 65,535.

Other common ports

All port numbers