21Port
TCPProtocol
ftpIANA service nameFile transferCategory
Port range
21 is a well-known (system) port (range 0–1023). On Linux and macOS, binding to it traditionally needs root or the CAP_NET_BIND_SERVICE capability.
Security
Only open port 21 to the hosts that need it. Prefer the encrypted variant of the protocol where one exists.
Open port 21 in a firewall
ufw sudo ufw allow 21/tcp iptables sudo iptables -A INPUT -p tcp --dport 21 -j ACCEPT firewalld sudo firewall-cmd --permanent --add-port=21/tcp Windows New-NetFirewallRule -DisplayName "FTP control 21" -Direction Inbound -Protocol TCP -LocalPort 21 -Action Allow
Check if port 21 is open
nc -vz example.com 21 Test-NetConnection example.com -Port 21 # PowerShell sudo ss -tulpn | grep ':21 ' # what is listening locally (Linux)