Toolman

What port does FTP use?

FTP uses 20 and 21, and which one depends on what you are doing.

Two ports because the protocol separates commands from data — the design that makes FTP awkward through firewalls.

PortProtocolNameWhat it is for
20TCPFTP dataThe data channel of the classic File Transfer Protocol. The control channel is port 21.
21TCPFTP controlThe command channel for FTP: login, directory listings and transfer commands.

Exposing it

Unencrypted. Use SFTP (port 22) or FTPS instead — plain FTP sends credentials in clear text.

Checking it is listening

sudo lsof -i :20          # macOS, Linux
netstat -ano | findstr :20   # Windows
nc -zv host 20               # from elsewhere

An "address already in use" error on a port nothing appears to be holding usually means the socket is in TIME_WAIT rather than that a process has it — the ports reference covers that and the ephemeral range.

Frequently asked questions

What port does FTP use?

FTP uses ports 20, 21, and they do different jobs. 20: The data channel of the classic File Transfer Protocol. The control channel is port 21. 21: The command channel for FTP: login, directory listings and transfer commands.

Is port 20 safe to expose to the internet?

Unencrypted. Use SFTP (port 22) or FTPS instead — plain FTP sends credentials in clear text.

How do I check whether FTP is listening?

sudo lsof -i :20 on macOS or Linux, netstat -ano | findstr :20 on Windows. From another machine, nc -zv host 20 says whether anything answers.

Other services

Port 20 in full · Port 21 in full · Every service · All port numbers