top of page

What is FTP (File Transfer Protocol)?

Oct 24
12 min read
What is FTP (File Transfer Protocol)?

 

FTP (File Transfer Protocol) is a client-server protocol for transferring files over a TCP/IP network. It uses a control connection for commands and replies, plus a separate data connection for file contents and directory listings. That separation explains a common puzzle: you can log in successfully but still be unable to list a folder, upload or download.

 

Plain FTP does not encrypt usernames, passwords or file contents. If a service supports secure file transfer, select the exact protocol it requires. FTPS adds TLS protection to FTP; SFTP is a separate protocol carried over SSH. Their similar names do not make them interchangeable.

 

FTP is one mechanism within the broader subject of data transfer. Understanding its connections, security settings and completion checks matters more than simply seeing a progress bar reach 100%.

 

What does FTP do?

 

An FTP client connects to an FTP server, authenticates where required and requests operations within the account's permitted directories. It can download files, upload files, list directories and, when authorised, create directories, rename files or delete them. The server controls which operations and paths the account may use.

 

Examples include maintaining a legacy website, exchanging files with an organisation or moving data between managed systems. FTP provides file operations; it does not automatically provide synchronisation, version history, conflict resolution or a backup policy. Uploading a replacement can overwrite the only available copy if the server allows it.

 

The underlying model is specified in RFC 959, File Transfer Protocol, published in October 1985 as the core Internet Standard. Later extensions add features such as IPv6 support and machine-readable listings. An individual server's supported commands and security policy still matter.

 

How FTP's two connections work

 

The client normally opens a TCP control connection to server port 21. This is a default, not an obligation: a service can listen on another configured port. Commands and numerical replies travel over this connection, which generally remains open while the session performs several operations.

 

The data connection is negotiated separately. In the usual stream-transfer model, a new data connection is used for a file or listing and then closed. Reaching the control port therefore proves only one part of the path works.

 

Operation

Control connection

Data connection

Log in

USER and PASS, with replies

Normally none

Download a file

RETR and completion replies

File bytes from server to client

Upload a file

STOR and completion replies

File bytes from client to server

List a directory

LIST, NLST or MLSD and replies

Listing from server to client

Check a single item's facts

MLST, where supported

Facts are returned on the control connection

 

Reply codes describe stages and outcomes. A 230 reply indicates a successful login; 150 commonly announces that a data operation is about to begin; 226 commonly reports its successful completion. The exact sequence depends on the operation and implementation. A successful login does not establish that the next data endpoint is reachable.

 

Directory listings deserve particular attention. A graphical client may look as though it has frozen immediately after login because it requests a listing automatically. That listing needs a working data connection too.

 

Active and passive FTP: who opens the data connection?

 

Active and passive modes describe connection initiation. Both modes can upload and download. Passive does not mean downloading, and active does not mean uploading.

 

Passive and active FTP diagram showing the client initiating control in both modes, client initiating passive data, and server initiating active data; arrows show TCP connection initiation rather than file direction

 

Passive FTP

 

In passive mode, the client asks the server for a data endpoint and then opens a TCP connection to it. The client therefore initiates both the control and data connections. This often fits a client behind a stateful firewall or NAT, provided outbound access and the server's passive configuration allow it.

 

The older PASV command returns a 227 reply containing an IPv4 address and two port-number bytes. For example, port bytes 195 and 80 mean 195 × 256 + 80 = 50,000. This is a protocol arithmetic example, not a recommended firewall rule or an observed port from our test.

 

If a server advertises an unreachable private address, or announces a port outside the forwarded and permitted passive range, login may work while transfers fail. Some clients compensate for misleading PASV addresses, but relying on that does not fix a misconfigured server.

 

Active FTP

 

In active mode, the client supplies a listening data endpoint using PORT or its extended counterpart EPRT. The server initiates the data connection back to the client. That inbound connection can be difficult when the client sits behind NAT or a firewall without a suitable configuration.

 

Traditional active FTP uses server TCP port 20 as its default data source port, but “FTP always transfers files on port 20” is misleading. Passive mode uses a negotiated server data port, and implementations or configurations can differ. The control and data endpoints must be understood separately.

 

EPSV, IPv6 and NAT

 

EPSV returns a port in a 229 reply; the client normally uses the same server address and address family as the control connection. It avoids embedding the IPv4 address found in PASV replies and can be used with IPv6. EPRT extends active-mode endpoint specification to additional address families.

 

These mechanisms are defined in RFC 2428, FTP Extensions for IPv6 and NATs, published in September 1998. EPSV removes one address-advertising problem. It does not open blocked ports, configure a router or guarantee connectivity through every NAT arrangement.

 

FTP, FTPS and SFTP are different choices

 

Protocol

Protection and transport

Common connection arrangement

Plain FTP

No built-in encryption for credentials or contents

Control usually TCP 21; separate data connection

Explicit FTPS

FTP upgraded using AUTH TLS; data protection must also be negotiated

Control commonly TCP 21; separate data connection

SFTP

SSH File Transfer Protocol over an encrypted SSH transport

Commonly TCP 22; operations use the SSH connection

HTTPS file transfer

HTTP protected by TLS

Commonly TCP 443; service-specific upload and download behaviour

 

Ports are conventions, not reliable protocol detection. Typing a different port into an FTP client does not turn it into an SFTP client. The client must support and select the service's actual protocol. Some services also use implicit FTPS, where TLS begins immediately on connection; follow their explicit instructions rather than guessing a mode.

 

FTPS must protect both channels

 

With explicit FTPS, AUTH TLS negotiates TLS for the control connection. Protecting file contents requires the appropriate data-channel protection too. The protocol uses PBSZ 0 and PROT P for private, TLS-protected data; PROT C requests clear data. A protected login alone is insufficient evidence that the files are encrypted in transit.

 

The negotiation is described in RFC 4217, Securing FTP with TLS, published in October 2005. Its historical TLS references are not a current deployment guide. Use maintained software and a modern TLS policy; the later IETF TLS recommendations in RFC 9325 reject TLS 1.0 and 1.1.

 

Verify the server certificate against the intended hostname and a trusted chain. An unexpected certificate warning needs investigation, not an automatic bypass or a switch to plain FTP. For SFTP, verify the SSH host key through a trusted channel instead; that is a different identity check.

 

FTPS retains FTP's separate data connections. A firewall helper that normally reads plain FTP commands cannot generally inspect an encrypted control session. Correct server addresses, passive port ranges and firewall rules remain necessary. TLS protects transport; it does not grant safe permissions, create backups or prove that an uploaded file is appropriate to publish.

 

Original Techie Broadband test: login is not a transfer test

 

We tested this distinction on 24 October 2026 using Python 3.12.14's ftplib client and a task-local pyftpdlib 2.2.0 server. The server listened only on IPv4 loopback, 127.0.0.1, using an automatically allocated control port, 33929. It used temporary accounts and files and was shut down afterwards.

 

The synthetic source contained every byte value from 0 to 255 repeated 4,096 times: exactly 1,048,576 bytes, or 1 MiB. We compared returned bytes directly and checked SHA-256 hashes, rather than relying on a client completion message.

 

Test

Observed result

Passive directory listing

Returned the expected source filename

Passive binary download

Exact source bytes and matching SHA-256

Passive binary upload

Exact uploaded bytes and matching SHA-256 for the deliberately reversed test payload

Resumed download

A trusted 524,288-byte prefix plus the retrieved 524,288-byte tail exactly matched the source

Active-mode download using PORT

Exact source bytes and matching SHA-256

EPSV download over IPv4

Exact source bytes and matching SHA-256

Login with an unusable advertised data endpoint

Login succeeded; opening the data connection failed; the control connection still answered NOOP

 

For the last test, the server deliberately advertised a reserved local port with no listening socket. The client received a connection refusal while trying to open the data socket for a directory-listing attempt, before sending the listing command. It had already received a successful 230 login reply, and a subsequent control-channel NOOP still received 200.

 

This reproduces the diagnostic separation between authentication and data connectivity. It does not reproduce a real firewall timeout, packet loss or a particular router's NAT behaviour. These were local plain-FTP tests, not FTPS, SFTP, IPv6, internet-throughput or ISP tests. A correct local transfer also says nothing about durable storage after a server crash.

 

What you need before connecting

 

Obtain the connection details from the service operator through a trusted route. A saved connection profile should match the actual service, including its required protection settings.

 

  • The hostname and exact protocol: FTP, explicit or implicit FTPS, or SFTP.

  • The configured port and permitted authentication method.

  • The expected TLS certificate identity or SSH host-key verification information.

  • The account's allowed directory, upload permissions and any quota or file-size limit.

  • Whether passive mode, a particular data port range or client address restrictions apply.

  • A safe test directory and a recovery plan before replacing important files.

 

Use a small disposable file to check the complete workflow: connect, verify identity, authenticate, list the intended directory, upload, download and compare. A read-only account should be tested only for its authorised operations. Keep credentials out of screenshots, shared logs, scripts committed to repositories and copied command histories.

 

An anonymous login, where a server deliberately offers one, is a server policy rather than a promise that every path is public or writable. For sensitive data, do not treat a familiar LAN, a private address or an account password as encryption.

 

FTP infographic explaining separate control and data connections, passive and active modes, FTPS and SFTP security, and file size and trusted hash verification

 

FTP on a UK broadband connection

 

Using a remote server versus hosting one at home

 

A home user acting as a passive FTP client normally initiates outbound connections to the remote server. Hosting an FTP server at home has different requirements: other machines must be able to reach its control service and its configured passive data endpoints.

 

CGNAT can prevent unsolicited inbound IPv4 connections from reaching a home server, even when the home router has a forwarding rule. A reachable public IPv4 arrangement, or an appropriate IPv6 service with correct addressing, server support and firewall rules, may be needed. IPv6 availability and inbound permissions must be checked rather than assumed.

 

For a server behind ordinary IPv4 NAT, the operator must align the advertised address, passive port range, router forwarding and host firewall. Opening only TCP 21 can leave the control session working and the data path broken. Do not expose broad port ranges or disable a firewall as a substitute for understanding the required endpoints.

 

These are topology requirements, not claims that a particular UK provider supports a particular configuration. Check the current terms, addressing and inbound-access options of the actual broadband service before planning to host anything.

 

Why FTP can be slower than the broadband package speed

 

An upload to a remote FTP server uses the home's upstream capacity; a download uses its downstream capacity. Active or passive mode does not reverse those directions. The server's storage, account limits, CPU, TLS processing, network path, local WiFi or Ethernet and other traffic can all limit the result.

 

The distinction between package download figures and upload speed is particularly relevant when sending backups or large project files from home. A fast access connection cannot make a slow remote disk or restricted server accept data faster.

 

As an ideal arithmetic example, a decimal 1 GB file contains 8,000,000,000 bits. At a constant 20 Mbit/s of file payload it takes 400 seconds, or 6 minutes 40 seconds. At 100 Mbit/s it takes 80 seconds. Those figures exclude setup time and assume the stated rate is available to file payload throughout; they are not measured FTP results or promises based on a broadband sync rate.

 

Many small files can take longer than one equally sized large file because commands, replies and repeated data-connection setup add work and round trips. TLS can add further negotiation and processing. Carefully limited parallel transfers may help some workloads, but excessive concurrency can trigger server limits, compete with other traffic and worsen responsiveness. Measure the complete path before changing several settings at once.

 

Binary mode, resuming and checking the finished file

 

Use the right representation

 

Binary transfer, commonly selected with TYPE I, preserves file bytes. ASCII transfer can convert line endings between systems. That conversion may be intended for some text workflows, but it can corrupt an archive, image, executable or any file requiring an exact byte match.

 

Do not confuse transfer representation with filename encoding. A correct file payload can still arrive under an unexpected name if client and server disagree about character handling. Check names, case sensitivity and destination paths when moving files between operating systems.

 

Resume only a matching partial file

 

Resume support depends on the server and client. RFC 3659, published in March 2007, defines extensions including restart behaviour for stream transfers. A restart offset tells the server where to continue; it does not establish that the bytes already held locally belong to the current remote file.

 

Our test resumed at byte 524,288 only after preserving a known matching prefix of an unchanged source. If the source has changed, or the partial copy came from another version, joining an old prefix to a new tail can create the wrong file even when the transfer completes. Restart from the beginning when the match cannot be established.

 

Completion is one check, not every check

 

A successful FTP completion reply concerns the requested operation. It is not a cryptographic comparison with a trusted original, a guarantee of storage durability or proof that an application has accepted the file.

 

Check the expected filename and byte count, then compare a strong hash with a reference obtained through a trusted route where integrity matters. The checksum explanation covers why the reference and algorithm matter. A matching hash supplied by the same untrusted source as the file cannot independently establish authenticity.

 

For publishing workflows, upload to a temporary name where the service supports it, verify the contents and then use its supported rename or release process. Do not assume every server, filesystem or application provides an atomic replacement, or that an overwritten file can be recovered. Preserve an appropriate backup before replacement.

 

Troubleshooting FTP without guessing

 

Use the point of failure to narrow the problem. Save a redacted client log containing the protocol, reply codes and relevant endpoint information, without passwords or sensitive paths.

 

  1. Confirm the hostname, protocol and configured port against the service's instructions. A failed TCP connection points towards name resolution, reachability, listening service or filtering before account permissions become relevant.

  2. Verify the TLS certificate or SSH host key using the proper process. Resolve identity or protocol errors before attempting to move sensitive data.

  3. Check authentication. A 530 reply concerns login or authorisation; recheck the account and required authentication method without repeatedly guessing passwords.

  4. If login works but listing fails, inspect the negotiated data endpoint and active/passive mode. Check the passive address and range, inbound requirements, IPv4/IPv6 path and any FTPS data-channel protection requirement.

  5. If listing works but one operation fails, check its exact path, case, permissions, quota, available space and file-size restrictions. A 550 reply can indicate an unavailable file or denied access; it does not uniquely mean the file is missing.

  6. For an interrupted transfer, preserve the original, inspect the error and decide whether a matching partial file can safely be resumed. Compare the final size and trusted hash before replacing a good copy.

  7. For poor performance, compare a permitted large-file transfer with a small-file workload, check wired local connectivity and inspect both endpoints' limits. Change one relevant variable at a time.

 

A 425 reply commonly indicates that the data connection could not be opened; 426 indicates a transfer was aborted. A refusal, a timeout, a TLS negotiation failure and a permissions error suggest different causes. Our deliberate refusal test demonstrates only the first of those connection failures, not every real-world reason for a failed listing.

 

Key takeaway

 

FTP's defining operational feature is its separate control and data connections. Test the file operation you need, not just login, and understand who initiates the data connection. Choose the correct secure protocol, verify the remote identity and check the finished file before treating the job as complete.

 

For related networking definitions, use the Techie Broadband terminology guide.

 

Frequently asked questions

 

What does FTP stand for?

 

FTP stands for File Transfer Protocol. It is a client-server protocol that uses a control connection for commands and replies and a separate data connection for files and directory listings.

 

Is FTP secure?

 

Plain FTP does not encrypt credentials or file contents. FTPS can protect FTP with TLS when both control and data protection are correctly configured. SFTP is a different protocol over SSH. Verify the server identity and use the protocol required by the service.

 

What port does FTP use?

 

FTP normally uses TCP port 21 for the control connection. Its data connection is separate: passive mode uses a negotiated server port, while traditional active mode uses server port 20 as the default data source. Configurations can use different ports.

 

What is the difference between active and passive FTP?

 

In passive mode, the client opens both control and data connections. In active mode, the server opens the data connection to a client-supplied endpoint. Both modes support uploads and downloads; their names describe connection initiation.

 

Why can I log in to FTP but not see any files?

 

Login uses the control connection, while a directory listing normally needs a separate data connection. An unreachable passive endpoint, blocked port, unsuitable active-mode path or incorrect FTPS data protection can therefore prevent a listing after successful login. Path permissions can also matter.

 

Does FTP work behind CGNAT?

 

A passive FTP client can often connect out from behind CGNAT if outbound access and the remote server configuration allow it. Hosting a server reachable through unsolicited inbound IPv4 is a different problem and may require a public addressing arrangement or suitable IPv6 connectivity with correct firewall rules.

 
 
UK Techie Broadband Providers
bottom of page