LightAtom

Port 21: What It Is Used For (FTP)

Port 21 is the control channel of FTP, the old, unencrypted file-transfer protocol. Data moves over separate ports.

FTP predates encryption and firewalls: its separate data connection is why it often breaks behind NAT unless passive mode is used. On a Mac, Finder's Connect to Server can mount ftp:// shares read-only; for uploads you need an app such as Transmit or Cyberduck, or better, SFTP.

Facts

Port
21
Protocols
TCP
Service
FTP

What uses port 21

FTP servers: legacy file uploads to web hosts, some printers and scanners, and old data feeds. Commands go over 21; files go over a second connection (port 20 in active mode, a random high port in passive mode).

On a Mac

macOS removed its built-in FTP server and the ftp command long ago, and Finder can only read FTP shares, not write. Mac apps like Transmit or Cyberduck connect out to 21 when you use FTP.

sudo lsof -nP -iTCP:21

Security

FTP sends passwords and files unencrypted. Use SFTP (port 22) or FTPS instead.

Frequently asked questions

Is FTP secure?

No. FTP sends usernames, passwords and files in plain text. Use SFTP or FTPS instead.

What is the difference between port 20 and 21?

21 carries FTP commands; 20 carries data in active mode. In passive mode, data uses a high port the server chooses.

Can a Mac connect to FTP?

Finder can mount FTP read-only via Go › Connect to Server. For uploads, use an FTP client such as Cyberduck or Transmit.

LightAtom team

The people who build LightAtom, a network monitor for macOS.