Is port 21 (FTP) exposed to the internet, and is that a credential risk?
Port 21 is the default control port for FTP, a 1980s file-transfer protocol that sends usernames and passwords as plain, unencrypted text over the network. Port 21 isn't on AdminKit's port-check tool's current nine-port list, so this guide shows how to manually confirm your own public IP still answers on it before an intercepted credential becomes a real breach.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- Port 21 is FTP’s control channel. File contents travel on a second connection, and both are unencrypted unless the server uses FTPS.
- Usernames and passwords cross the network in clear text, so an exposed FTP login leaks credentials to anyone on the path.
- Anonymous FTP and old server software add their own risks; well-known FTP server flaws have allowed file access or code execution without a login.
- AdminKit’s port check does not test port 21. Test it manually from outside your network and look for the
220greeting.
Why is FTP’s own design the risk?
FTP predates modern transport encryption by decades, and it shows in the protocol’s own specification. RFC 959 (also on the IETF Datatracker), the document that defines FTP, describes the USER command as identifying “the user required by the server for access to its file system” and the PASS command as carrying “the user’s password” immediately after it — both sent as plain text over the control connection. The RFC is explicit that it has no technical fix for this: it says only that “it is therefore the responsibility of the user-FTP process to hide the sensitive password information” from being displayed on screen, which is about hiding a password from someone looking over a shoulder, not about encrypting it on the wire. Four decades later, that’s still exactly how an unmodified FTP server authenticates a login.
Why does server-security guidance treat FTP as a known risk?
This isn’t a niche reading of an old document — it’s the standard framing in modern server-hardening guidance. NIST SP 800-123, the Guide to General Server Security, covers exactly this category of risk under its system and communications protection guidance: authentication protocols that transmit reusable credentials like passwords in the clear over a network you don’t fully control are a well-established weak point, because anyone positioned to observe that traffic — on a shared network, a compromised intermediate hop, or through basic packet capture — reads the username and password as plainly as the legitimate client does. A password that would be reasonably safe behind TLS or an SSH tunnel is not safe at all carried by FTP’s original control channel.
How do you check your own exposure?
AdminKit’s open ports check checks a fixed nine-port list, and port 21 isn’t on it — confirm your current public IP first with what is my IP, then test the port manually from a machine outside your network with nc -vz -w 3 203.0.113.5 21. A connection that succeeds means the port is reachable; “connection refused” or a timeout means it’s closed or filtered. If port 21 answers and the server behind it accepts plain FTP logins rather than FTPS, every credential used against it is traveling exactly as RFC 959 describes: in the clear.
How do FTP’s two connections work?
FTP does not move files over port 21. RFC 959 splits a session into a control connection, which carries commands such as USER, PASS, LIST and RETR, and a separate data connection for each listing or file. How the data connection is set up depends on the mode:
| Mode | Who opens the data connection | Ports involved |
|---|---|---|
Active (PORT) | The server connects back to an address and port the client named | Server source port 20 to a client port |
Passive (PASV, EPSV) | The client connects to a port the server named | A range of high ports on the server |
This is why exposed FTP servers so often come with a wide range of other open ports: passive mode needs a block of high ports forwarded or allowed through the firewall as well. Closing port 21 removes the control channel, but check that the passive range was removed from the router at the same time.
The PORT command also allowed the classic “FTP bounce” problem, where a client tells a server to open a data connection to a third party’s address. RFC 2577, FTP Security Considerations describes the bounce attack and recommends that servers refuse PORT commands naming any address other than the client’s own. Most current servers do this by default; old embedded servers are the ones to check.
What does an FTP server reveal before anyone logs in?
An FTP server speaks first, with a 220 reply that often includes its software name and version. Example output (documentation address, illustrative greeting):
$ nc -v -w 3 203.0.113.5 21
Connection to 203.0.113.5 21 port [tcp/ftp] succeeded!
220 (vsFTPd 3.0.5)
That greeting is enough for a scanner to look up known flaws. Two examples from NVD show why the version matters as much as the credentials:
- CVE-2011-2523: a tampered vsftpd 2.3.4 download contained a backdoor that opened a shell when a login name ended in
:). - CVE-2015-3306: ProFTPD’s
mod_copymodule let unauthenticated clients copy files on the server withSITE CPFRandSITE CPTO.
Both are old, which is the point: FTP daemons on NAS boxes and appliances tend to stay on the firmware they shipped with.
Anonymous FTP is the other thing to test. RFC 1635 describes the convention of logging in as anonymous for public file archives. On a home or office server, an anonymous login that works is almost always a mistake, and a writable anonymous directory lets strangers store files on your hardware.
To test your own server, connect from outside your network with any FTP client, log in as anonymous and give any address as the password. RFC 959’s reply codes make the answer unambiguous: 230 means the server accepted the login, and 530 means it refused. If you get 230, run ls to see what the anonymous user can read, then turn anonymous access off in the server or NAS settings before doing anything else. Repeat the test afterwards to confirm the 530 reply.
Which devices run FTP on port 21?
| Device or software | Why FTP is there |
|---|---|
| NAS devices | File access from older clients and backup tools; often a checkbox in the file-services menu |
| Routers with a USB storage port | Sharing an attached drive, sometimes with an “access from internet” option |
| Printers and scanners | “Scan to FTP” destinations, and on some models a built-in FTP server |
| IP cameras and DVRs | Uploading snapshots and recordings to an FTP server |
| vsftpd, ProFTPD, Pure-FTPd, FileZilla Server, IIS FTP | General-purpose servers on Linux and Windows hosts |
On a Linux host, ss -ltnp 'sport = :21' shows which daemon owns the port. On Windows, Get-NetTCPConnection -LocalPort 21 -State Listen gives the owning process ID. For a NAS or router, the port-forwarding table tells you which internal device a forward on 21 points to.
FTPS, SFTP and FTP: which one is on which port?
The names are close enough to cause mistakes in firewall rules:
| Protocol | Default port | Encryption |
|---|---|---|
| FTP | 21 (control) | None |
FTPS, explicit (AUTH TLS, RFC 4217) | 21 | TLS after the client asks for it; the server should refuse login without it |
| FTPS, implicit | 990 | TLS from the first byte |
| SFTP | 22 | SSH; a different protocol, not FTP over TLS |
An explicit-FTPS server still answers on 21 and still shows a 220 greeting, so a successful nc test does not tell you whether TLS is enforced. Check the server setting that requires TLS for logins (in vsftpd, force_local_logins_ssl=YES). If you move to SFTP, the exposure question becomes the one covered in is port 22 (SSH) exposed. The OpenSSH sftp client manual describes it as a file transfer program similar to ftp that performs all operations over an encrypted SSH transport.
How to fix it
- Migrate transfers to SFTP, which runs over SSH and gets that protocol’s existing encryption and key-based authentication, or to FTPS, which wraps the original FTP commands in TLS — either removes the cleartext-credential problem RFC 959 never solved.
- Remove anonymous or shared FTP accounts entirely; a shared login multiplies how many places a plaintext password can leak from.
- Firewall port 21 to only the specific source IP ranges that still need it while you migrate, rather than leaving it open to the whole internet in the meantime.
- Audit for forgotten FTP services on older appliances, NAS devices and legacy backup tools — plain FTP often survives longest on infrastructure nobody thinks to revisit.
- If a third party still requires plain FTP for a legacy integration, treat the credentials as already compromised: use a dedicated account with the minimum access that one integration needs, not a shared login that also reaches anything else.
None of this requires giving up file transfer over the internet entirely — it requires giving up the one part of FTP, RFC 959’s unencrypted USER/PASS exchange, that the protocol’s own authors never solved.
This same logic — a protocol with no encryption of its own, still found running on more devices than expected — is also why this site covers exposed Telnet devices: different protocol, same root cause.
Defensive use only
Every check this page links to is for assets you own or are explicitly authorized to test. Never scan, probe, or attempt to connect to a network or device you don’t control — AdminKit’s active checks only ever run against the IP making the request or an asset you’ve verified ownership of. See our Disclaimer and Acceptable Use Policy for the full terms. Port 21 sits alongside the other legacy and management-protocol exposure checks in AdminKit’s machine protocols cluster.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
Does AdminKit's port-check tool scan port 21?
No. The tool checks a fixed list of nine specific TCP ports (23, 554, 1883, 8883, 502, 7547, 80, 443, 8080) chosen for how often they turn up misconfigured on home and small-office devices — see the port-check tool page for the current list. 21 isn't on that list, so confirm your own exposure with the manual check below.
Is the problem FTP itself, or just one bad configuration?
It's the protocol's own design. FTP's defining document, RFC 959, specifies the USER and PASS commands that carry login credentials, and it acknowledges it has no way to protect them in transit — only that client software should try to hide the password on screen, not that the network transmission is encrypted.
Doesn't every FTP server support a secure mode?
Not the same thing as plain FTP. FTPS adds TLS encryption to the original FTP protocol, and SFTP is a completely different file-transfer protocol that runs over SSH — both exist specifically because plain FTP has no encryption of its own, but a server has to be explicitly configured to offer either.
Who would actually intercept an FTP password?
Anyone able to observe the network path between client and server — a shared or compromised network, an on-path attacker, or basic traffic capture — since the USER and PASS commands cross the wire exactly as typed, with nothing to decode.
What's the fastest fix if my own port 21 is reachable?
Disable plain FTP and move transfers to SFTP (over SSH) or FTPS (FTP over TLS), remove any anonymous or shared accounts, and firewall port 21 so only the specific source IPs that still need file transfer can reach it during the migration.
Sources
- RFC 959 — File Transfer Protocol (IETF), USER/PASS access control commands
- NIST SP 800-123 — Guide to General Server Security
- RFC 959 — IETF Datatracker document record
- RFC 2577 — FTP Security Considerations
- RFC 4217 — Securing FTP with TLS
- NVD — CVE-2011-2523, vsftpd 2.3.4 backdoor
- NVD — CVE-2015-3306, ProFTPD mod_copy
- OpenBSD manual — sftp(1), OpenSSH secure file transfer
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.