Port 21 is the FTP control port. The client connects to port 21 to issue FTP commands (USER, PASS, LIST, RETR). Data transfer uses a separate connection on port 20 (active mode) or a random client port (passive mode). FTP is unencrypted – SFTP (port 22) or FTPS should be used instead.
Port Number
21
Protocol
TCP
Service
File Transfer Protocol
Range
IANA Well-Known (0–1023)
Detect FTP server version and whether anonymous login is allowed
nmap -sV -p 21 targetTest anonymous FTP access
curl -v ftp://host/ --user anonymous:[email protected]Test STARTTLS (explicit FTPS) support on port 21
openssl s_client -connect host:21 -starttls ftpftp ftp.example.com
lftp -u user ftp.example.comFTP was defined in RFC 114 (1971), making it one of the oldest internet protocols still in use. RFC 959 (1985) standardized the modern version. SFTP (SSH-based, 1997) and FTPS (TLS-based, RFC 4217, 2005) are the secure replacements.
Should I use FTP, FTPS, or SFTP?
Use SFTP (port 22) for all new deployments – single port, encrypted, key-based auth. FTPS only if you must support legacy FTP clients. Never use plain FTP over untrusted networks.
Why does FTP need two ports?
FTP separates control (commands on port 21) from data (file transfers on port 20 or random high ports). This dual-channel design predates firewalls and causes NAT/firewall traversal issues that SFTP avoids entirely.