SFTP File Size Limit: Protocol Constraints, Packet Buffers, and Large Transfers
The SSH File Transfer Protocol (SFTP) imposes no fixed protocol-level file size ceiling, using 64-bit integer offsets to support theoretical file payloads up to 16 exabytes. Practical transfer limits arise from local filesystem bounds, OpenSSH packet buffer allocations, and network timeouts. Configuring client chunk sizes, keepalive settings, and server thresholds resolves transfer drops, while agent data pipelines benefit from high-capacity cloud workspaces.
Why the SFTP Protocol Architecture Has No Inherent File Size Limit
The SSH File Transfer Protocol (SFTP) enforces no fixed file size ceiling at the protocol layer, yet large file transfers fail routinely because engineering teams confuse transport specifications with operating system buffer limits, network timeouts, and local filesystem boundaries.
An SFTP file size limit refers to the maximum file payload that can be transferred over SSH File Transfer Protocol, typically governed by underlying filesystem bounds, SSH daemon buffer allocations, or client-side timeout settings rather than an arbitrary protocol ceiling. Unlike legacy file transfer protocols designed in earlier computing eras, SFTP was architected from its inception to accommodate massive storage volumes and large data streams.
The foundation of modern SFTP rests on the IETF specification draft-ietf-secsh-filexfer-02, which defines SFTP version 3 (the standard version across Linux, Unix, and Windows servers). In this specification, every file operation that reads or writes data uses 64-bit unsigned integers to declare the byte offset within the target file. Specifically, the write message payload (SSH_FXP_WRITE) is structured as follows:
uint32 id
string handle
uint64 offset
string data
Because the offset parameter is a 64-bit integer, the protocol mathematically addresses up to 2^64 - 1 bytes, which equals 18,446,744,073,709,551,615 bytes (approximately 16 exabytes when interpreted as a signed value). Consequently, the SFTP wire protocol will not block a file transfer whether the payload is a few megabytes or multiple terabytes.
64-Bit Integer Offsets Versus Legacy 32-Bit FTP Ceilings
A frequent source of confusion across technical documentation is conflating SFTP with classic FTP or FTPS. Classic FTP, originally specified in RFC 959, predated widespread 64-bit computing. Early FTP client and server implementations relied on standard 32-bit signed integers to track file pointers and stream sizes.
A signed 32-bit integer tops out at 2^31 - 1 bytes, creating an arbitrary 2 GB transfer protocol threshold. When legacy FTP daemons attempted to transfer a file exceeding this 2 GB boundary, the internal file offset counter wrapped into negative numbers, causing immediate transfer aborts, file corruption, or silent truncations. Even after FTP extensions added Large File Support (LFS) to handle 64-bit offsets, older scripts and appliances remained bottlenecked by 32-bit boundaries.
SFTP is not an extension of FTP; it is an independent subsystem operating inside an encrypted Secure Shell (SSH) transport session. Because SFTP version 3 defined its offset fields as 64-bit integers from the start, it never inherited the classic 2 GB barrier that plagued older transfer tools.
Protocol Packets Versus File Payloads
To understand how SFTP transfers massive files without a file-level cap, you must separate the overall file payload from individual protocol packets. SFTP does not transmit a file as a single unbroken stream. Instead, the client divides the file into smaller discrete data chunks, encapsulating each chunk inside an individual request packet.
While the file size offset is a 64-bit integer, individual packet lengths are governed by 32-bit fields. The specification dictates that the wire packet length field indicates the total size of the message following the field. However, implementations do not send gigabyte-sized packets. Instead, servers specify baseline expectations for maximum packet sizes to prevent buffer overflows and memory exhaustion on the host machine.
A large file transfer consists of sequential or pipelined packet requests, each carrying a payload chunk (typically between 32 KB and 256 KB) directed at an advancing 64-bit byte offset. If a transfer fails mid-stream, the cause is never that the file exceeded the protocol envelope; the failure points directly to intermediate network interruptions, daemon buffer mismatches, or target storage restrictions.
Related guides
- S3 Presigned URL File Size Limit: Upload Caps, Multipart Transfers & AlternativesThe Amazon S3 presigned URL file size limit is strictly 5 GB for a single HTTP PUT operation, governed by the PutObject...
- Notion File Upload Limits: Size Caps by Plan and Large-File WorkaroundsNotion limits individual file uploads to 5MB on the Free plan and provides unlimited file uploads with a 5GB maximum...
- AWS Lambda File Size Limits: Payload, Package, and Ephemeral Storage CapsAn AWS Lambda file size limit encompasses the execution constraints of AWS Lambda functions, specifically the 50MB...
- Cloudflare Upload Limits: Plan Caps, Error 413, and WorkaroundsCloudflare restricts client request bodies passing through its edge proxy to 100 MB on Free and Pro tiers, 200 MB on...
- AWS Bedrock File Size Limits: Document Constraints in Knowledge Bases and Converse APIAWS Bedrock Knowledge Bases enforces a 50 MB per-document limit for file ingestion, while the Bedrock Converse API caps...
- Box File Size Limit: Upload Caps by Plan and Large-Corpus AI SearchBox documents an individual file upload limit across account plans, ranging from 250 MB on free accounts to 5 GB on...
More on this subject: Agent File and Document Workflows (298 guides)
How Operating System Quotas and Filesystem Boundaries Restrict Transfers
When an SFTP upload halts with an error such as General failure, Permission denied, or File size limit exceeded, the breakdown almost always originates in the underlying operating system or storage volume backing the SFTP daemon. The server cannot write a byte sequence that exceeds the physical or logical capabilities of the filesystem hosting the target directory.
Storage volumes vary dramatically in their maximum file size thresholds. If an automated pipeline directs an SFTP upload to a legacy FAT32 filesystem (frequently encountered on external drives, embedded appliances, or network hardware), transfers halt when crossing the filesystem ceiling. The operating system kernel returns an EFBIG (File too large) system call error to the SFTP server, which translates the failure into an opaque status code (SSH_FX_FAILURE).
Modern enterprise filesystems offer significantly higher file size ceilings, easily accommodating massive archives, virtual disk images, or raw AI datasets. Standard Linux filesystems like EXT4, high-throughput architectures like XFS, and advanced volume managers like ZFS accommodate massive files reaching multi-terabyte and exabyte scales without protocol-level impedance.
Operating System Resource Quotas and Ulimit Constraints
Beyond physical filesystem formatting, the operating system account assigned to the SFTP connection may be subject to administrative resource restrictions. In multi-tenant environments, systems administrators configure process limits using ulimit or PAM configuration files.
The maximum file size created by a user process is governed by the fsize resource limit:
# check the maximum file size limit for the current shell session
ulimit -f
# check soft and hard file size boundaries
ulimit -Sa
ulimit -Ha
If the user account running the SFTP subsystem has fsize set to a specific block quota, the Linux kernel sends a SIGXFSZ signal to the server process the moment a write crosses that boundary. If the daemon does not catch the signal, the process exits abruptly, severing the SSH connection without providing a helpful error message to the client.
Similarly, user and group disk quotas monitor available storage blocks on the target mount. When a user quota is exhausted during a transfer, the write operation halts with SSH_FX_FAILURE, leaving a partial, corrupted file on disk.
Cloud Gateway Limits: AWS Transfer Family and Azure SFTP
Organizations frequently replace self-hosted SFTP servers with managed cloud SFTP endpoints, such as AWS Transfer Family or Azure Blob Storage SFTP. While these services eliminate host server maintenance, they enforce application-level file size and upload mechanics that supersede the SFTP protocol.
In AWS Transfer Family, files uploaded via SFTP are converted into Amazon S3 objects, subject to S3 single-object ceilings. Furthermore, because standard SFTP clients perform sequential writes at byte offsets rather than S3 multi-part API calls, AWS Transfer Family buffers writes into multi-part uploads in the background. If a transfer stream becomes inconsistent or client timeouts occur, the background multi-part upload fails to complete.
Similarly, Azure Blob Storage SFTP translates incoming SFTP data into Azure Block Blobs. Depending on the configured block size, Azure limits maximum block blob capacity based on its 50,000 block threshold per blob. Cloud infrastructure also introduces request throttling, API concurrency limits, and idle session disconnects that terminate transfers that run for multiple hours.
Comparison Table of SFTP Limits Across Environments
The following comparison table summarizes theoretical protocol specifications, implementation thresholds, and physical storage limits:
This architectural comparison demonstrates that resolving large file transfer problems requires auditing the host filesystem, user quotas, and network configuration rather than attempting to alter protocol-level settings.
How OpenSSH Packet Buffers and Chunk Sizes Impact Throughput
While SFTP imposes no upper ceiling on total file volume, OpenSSH (the reference implementation powering the vast majority of SFTP servers worldwide) enforces strict boundaries on individual packet sizes. Understanding these buffer mechanics is necessary to optimize transfer throughput and prevent unexplained connection drops.
In OpenSSH, the maximum allowable size of an SFTP message packet is defined by the compile-time constant SFTP_MAX_MSG_LENGTH in sftp-common.h. This constant is set to 256 KB (262,144 bytes), excluding the 4-byte message length header. OpenSSH enforces this 256 KB threshold to protect the server from memory exhaustion attacks. If a rogue client sends a packet header claiming an excessively large payload, an unconstrained server would attempt to allocate matching heap memory immediately. The 256 KB cap ensures bounded memory allocation per connection.
However, standard SFTP transfer chunks are even smaller. As noted in draft-ietf-secsh-filexfer-02, the specification recommends that all compliant servers should support packets of at least 34,000 bytes, which comfortably accommodates payload chunks of 32 KB (32,768 bytes) plus protocol header overhead. For decades, standard SFTP clients defaulted to 32 KB chunk requests when reading or writing files.
The OpenSSH 256KB Packet Ceiling and limits@openssh.com
Historically, the disparity between the client's conservative 32 KB chunk default and the server's 256 KB buffer capacity resulted in suboptimal transfer speeds, especially over high-bandwidth, high-latency network routes. To complete a massive file transfer using conservative 32 KB chunks, the client must execute hundreds of thousands of round-trip request and acknowledgment cycles.
To overcome this latency barrier without breaking protocol stability, OpenSSH 8.6 introduced a proprietary protocol extension named limits@openssh.com. During the initial connection handshake, an SFTP client supporting this extension sends an extended request querying limits@openssh.com. The server returns an extended reply declaring its exact operational boundaries:
uint64 max-packet-length
uint64 max-read-length
uint64 max-write-length
uint64 max-open-handles
In standard OpenSSH server builds, max-packet-length is reported as 262,144 bytes (256 KB), max-read-length as 262,144 bytes, and max-write-length as 261,120 bytes (SFTP_MAX_MSG_LENGTH - 1024, reserving space for headers). When an OpenSSH client connects to an OpenSSH 8.6+ server, it automatically scales its internal transfer chunks up from 32 KB to the maximum supported write length. This dynamic negotiation substantially reduces the total number of round trips, dramatically increasing throughput on large file transfers.
Tuning Client Buffers and Concurrency for High-Throughput Transfers
If you are running automated transfer scripts or command-line operations with older OpenSSH client versions, or connecting to third-party SFTP appliances that do not advertise limits@openssh.com, you can tune buffer sizes manually.
The OpenBSD sftp(1) client provides the -B flag to define buffer capacity. As documented in the OpenBSD manual pages, the default buffer size is 32,768 bytes. Specifying a larger buffer size reduces the number of round trips required to transmit the file, provided the target server accepts the packet dimensions:
# transfer a large archive with a 256KB buffer chunk size
sftp -B 262144 user@remote-server.com
In addition to buffer chunk size, transfer throughput over high-latency networks depends heavily on request pipelining. Because SFTP operates over TCP, waiting for an acknowledgment packet after every single chunk leaves the network link idle for the duration of the round-trip time (RTT). The OpenSSH sftp client manages this through concurrent in-flight requests, configured with the -R parameter:
# configure 64 concurrent outstanding request packets
sftp -B 262144 -R 64 user@remote-server.com
With multiple requests pipelined concurrently, the client keeps megabytes of data in flight simultaneously. This saturates available network bandwidth and ensures that multi-gigabyte transfers complete rapidly before encountering transient network interruptions.
Scale Beyond SFTP Transfer Ceilings in Agent Workspaces
Eliminate packet buffer bottlenecks and network timeout drops with Fast.io shared workspaces. Connect agents via the Model Context Protocol at mcp.fast.io and store files up to 100 GB with built-in semantic search. Monthly plans start with a 14-day free trial that requires a credit card.
How to Diagnose and Resolve Large File Transfer Timeouts
The most common reason large SFTP transfers fail is not a hard file size cap, but an unmanaged network timeout. When transmitting a massive database backup or large video asset archive, the transfer duration frequently extends across multiple hours. During extended transfers, stateful firewalls, Network Address Translation (NAT) gateways, and load balancers continuously track the TCP state table.
If an SFTP connection experiences a temporary delay, such as disk I/O flush bottlenecks on the server, local hashing calculations, or network congestion, the TCP stream may become temporarily silent. Stateful firewalls routinely drop idle TCP connections after 5 to 15 minutes of inactivity. When the client or server attempts to send the next packet, it encounters an abrupt Connection reset by peer or Broken pipe error, terminating the transfer after tens of gigabytes have already traveled across the wire.
Preventing Connection Drops with Keepalive Directives
To prevent stateful firewalls and NAT routers from tearing down long-running large file transfers, administrators must configure SSH keepalive packets. These null packets ensure that data traverses the encrypted tunnel at regular intervals, keeping state tables active even during disk write stalls.
On the client side, configure keepalive parameters in ~/.ssh/config:
Host *
ServerAliveInterval 30
ServerAliveCountMax 10
TCPKeepAlive yes
ServerAliveInterval 30: Instructs the SSH client to send an encrypted heartbeat probe through the tunnel if 30 seconds pass without any data packets.ServerAliveCountMax 10: Tells the client to keep attempting probes until ten consecutive heartbeats go unacknowledged before declaring the session dead.
On the host SFTP server, configure equivalent settings in /etc/ssh/sshd_config:
ClientAliveInterval 30
ClientAliveCountMax 10
TCPKeepAlive yes
Another subtle cause of mid-transfer aborts on massive files is SSH session rekeying. By default, OpenSSH initiates a cryptographic rekey after transferring a specific data threshold or after one hour. On high-throughput connections, frequent rekeying can introduce micro-stalls that cause sensitive client software to time out. You can adjust the rekey threshold in sshd_config:
# rekey after 10G data or 1h to maintain cipher freshness
RekeyLimit 10G 1h
Resuming Partial Uploads and Verifying File Integrity
When a multi-gigabyte SFTP transfer aborts despite keepalive tuning, re-uploading the entire file from byte zero consumes unnecessary bandwidth and delays data pipelines. The standard OpenSSH sftp interactive client includes native commands to resume broken transfers:
# resume a broken download from the remote server
sftp> reget remote_archive.tar.gz
# resume a broken upload to the remote server
sftp> reput local_archive.tar.gz
The reget and reput commands inspect the existing partial file size on the destination, seek to that exact 64-bit byte offset, and resume streaming only the remaining payload.
However, automated shell scripts often require non-interactive resumption. When building headless data migration pipelines, pairing SSH with rsync provides reliable, resumable file synchronization with partial progress retention:
# transfer large files over SSH with automatic resumption and progress tracking
rsync -avzP --partial --inplace -e ssh /data/backups/ user@remote-server.com:/storage/backups/
End-to-End File Integrity Verification
A significant limitation of SFTP version 3 is the absence of native end-to-end cryptographic checksumming. Unlike modern object storage APIs that validate MD5 or SHA-256 hashes as part of the upload transaction, SFTP v3 acknowledges that packets were received, but provides no built-in mechanism to confirm that the file on disk matches the source file bit-for-bit.
To ensure data integrity after transferring massive files over SFTP, always execute post-transfer checksum validation:
# generate local checksum
sha256sum local_archive.tar.gz > local.sha256
# generate remote checksum over SSH and compare
ssh user@remote-server.com "sha256sum /storage/local_archive.tar.gz" > remote.sha256
diff -u local.sha256 remote.sha256
Confirming checksum equality guarantees that intermediate packet retries, disk write stalls, or unexpected socket drops did not corrupt the file payload.
High-Capacity Cloud Workspaces and MCP for Agent Workflows
As engineering teams deploy autonomous AI agents (such as Claude Code, Cursor, Codex, and OpenClaw) into production workflows, the limitations of SFTP become acutely apparent. AI agents frequently process extensive codebases, multi-gigabyte media assets, technical documentation corpora, and structured datasets.
Attempting to coordinate agent workflows across legacy SFTP endpoints introduces substantial friction:
- Brittle Authentication and Host Keys: Agents must manage raw SSH private keys, password credentials, and known-hosts validation, introducing credential leakage risks in automated scripts.
- Passive, Unindexed Storage: SFTP servers are passive bit stores. They offer no search capabilities, no automatic file indexing, and no semantic understanding. An agent seeking a specific design specification inside a massive document archive must download the entire archive locally, exhausting its context window and compute resources.
- Lack of Native Concurrency Safeguards: Multiple agents or humans accessing the same SFTP directory risk silently overwriting each other's outputs without version control or advisory leasing.
Transitioning to Fast.io Intelligent Workspaces
Fast.io provides a modern, collaborative alternative to legacy SFTP infrastructure, purpose-built for agentic teams through shared workspaces. Instead of maintaining physical SFTP daemons, storage partitions, and firewall keepalives, teams operate in org-owned cloud workspaces engineered for multi-agent coordination.
- Substantial File Upload Ceilings: Fast.io supports massive single-file uploads that eliminate the need for manual chunking scripts.
- Built-in Intelligence Mode: When Intelligence is enabled on a workspace, files are automatically indexed on arrival. Fast.io provides hybrid Search combining full-text indexing, semantic search, and search-by-metadata-value. AI agents query documents directly to extract answers with citations, bypassing local file downloads.
- Advisory File Locks: Concurrent agent operations are protected through advisory per-file leases in workspace storage. Leases are acquired and released through MCP actions (
lock-acquireandlock-releaseon thestorage_managetool, withlock-statuson thestoragetool). Locks expire automatically unless heartbeated, ensuring deadlocks never block team workflows. Concurrent writes both land safely, and per-file version history preserves every version. - Detailed Activity Log: Workspaces maintain a detailed activity log tracking what changed in an organization and who changed it, including uploads, edits, moves, deletions, membership changes, and share creation (without logging passive file views or downloads).
- Cloud Sync and Import: Datasets can be imported from Google Drive, Dropbox, Box, and OneDrive, plus import from a URL without consuming local system bandwidth. Cloud Sync is available for Google Drive, Dropbox, Box, and OneDrive (one-way or two-way, on a schedule or on demand, never continuous or real-time).
Connecting AI Agents to Large Corpora via Fast.io MCP
Fast.io integrates directly with modern AI agents through the Model Context Protocol (MCP) using Streamable HTTP. Instead of scripting custom SFTP connections or managing file transfer daemons, developers connect agents to Fast.io workspaces using designated client endpoints:
https://mcp.fast.io/mcp/toolsfor Claude desktop, mobile, web, Claude Cowork, and general agent clients.https://mcp.fast.io/mcp/codefor coding agents operating in IDEs and terminals, including Claude Code, Cursor, Cline, and Gemini CLI.https://mcp.fast.io/mcp/operationsfor custom ChatGPT and Codex configurations (with the Fastio plugin being the preferred setup in ChatGPT and Codex).
Refer to the Fast.io MCP documentation for client-specific configuration guides.
Through the consolidated MCP toolset, agents authenticate securely via OAuth or scoped Bearer API keys. Agents can list workspace contents, execute structured metadata extraction using Metadata Views, retrieve targeted file chunks, and write outputs back to persistent workspaces with full version history, avoiding the operational overhead of managing physical SFTP servers.
The following table outlines available organization plans and capacities:
Monthly plans start with a 14-day free trial that requires a credit card, providing a production-ready foundation for high-capacity file collaboration. Review available options on the pricing page or explore storage for agents.
Architectural Comparison: SFTP Versus Intelligent Workspaces
The differences between maintaining traditional SFTP server endpoints and deploying intelligent agent workspaces illustrate why engineering teams are updating their file architecture:
- Transfer Mechanics: SFTP relies on sequential packet chunks over a single SSH session that is sensitive to network latency and firewall timeouts. Fast.io uses chunked multi-part cloud uploads designed for high-capacity transfers.
- Data Usability: Files uploaded to an SFTP server remain dormant bytes on a disk partition. Fast.io auto-indexes uploaded files, allowing humans and AI assistants to search, summarize, and cross-reference documents immediately.
- Collaboration and Delivery: Sharing an SFTP folder requires provisioning SSH user accounts and directory permissions. Fast.io provides branded shares (Send, Receive, and Exchange) that can be durable or expiring, with per-recipient access and the ability to disable file downloads without consuming extra member seats.
- Ownership Transfer: Autonomous agents can establish workspaces, ingest project files, configure shares, and transfer ownership to human stakeholders while retaining administrative access.
Sources
References used to verify factual claims in this guide.
-
According to the IETF specification for the SSH File Transfer Protocol (SFTP), version 3 mandates that compliant servers support data packets of at least 34,000 bytes to handle read and write transfer payload chunks of up to 32,768 bytes, operating with 64-bit integer file offset limits across client and server systems.
-
As documented in OpenBSD manual pages, the standard OpenSSH sftp client sets a default file transfer buffer size of 32,768 bytes per request, while daemon implementations manage packet limits, connection timeouts, and storage memory thresholds.
Frequently Asked Questions
Is there a file size limit for SFTP?
The SFTP protocol itself has no arbitrary file size limit. The specification uses 64-bit unsigned integers to define file offsets, providing a theoretical ceiling of 16 exabytes. Practical file transfer limits are governed entirely by the underlying operating system filesystem, disk quotas, daemon buffer sizes, or cloud gateway quotas.
Why does SFTP transfer fail on large files?
Large SFTP transfers typically fail due to network timeouts, firewall drops of silent TCP streams, filesystem restrictions (such as legacy FAT32 boundaries or EXT4 volume constraints), or process file size quotas (ulimit -f). Configuring keepalive settings like ServerAliveInterval and ClientAliveInterval prevents intermediate network disconnects.
How can I increase the maximum file size in SFTP?
Because the protocol has no built-in file limit, increasing transfer capacity requires adjusting environment constraints: verify that the destination disk filesystem supports large files (e.g., EXT4, XFS, or NTFS), check that user quotas and ulimit -f allow large file creation, and configure keepalive probes to prevent firewalls from terminating multi-hour transfers.
What is the difference between SFTP and FTP file transfer limits?
Classic FTP was originally designed with 32-bit signed integer offsets, creating a notorious 2 GB transfer ceiling in older clients and servers. SFTP is a completely different protocol operating over SSH that uses 64-bit integer offsets from version 3 onward, supporting multi-terabyte and exabyte-scale transfers natively.
What is the default packet and chunk size in OpenSSH SFTP?
OpenSSH enforces a maximum packet size limit of 256KB (SFTP_MAX_MSG_LENGTH) to prevent memory exhaustion attacks. Traditional client requests default to 32KB payload chunks, but modern OpenSSH versions dynamically negotiate larger chunks up to 256KB using the limits@openssh.com protocol extension.
How can interrupted large SFTP transfers be resumed?
Interrupted transfers can be resumed in interactive SFTP sessions using the reget (for downloads) and reput (for uploads) commands. For automated command-line workflows, administrators commonly use rsync with the --partial and --inplace flags over an SSH transport.
What are the file size limits on cloud SFTP services like AWS Transfer Family?
Managed cloud SFTP endpoints enforce backend storage limits. AWS Transfer Family caps single-file uploads at 5TB, reflecting Amazon S3 object limits. Azure Blob Storage SFTP limits individual block blobs to approximately 190TB depending on the configured block size.
Related Resources
Scale Beyond SFTP Transfer Ceilings in Agent Workspaces
Eliminate packet buffer bottlenecks and network timeout drops with Fast.io shared workspaces. Connect agents via the Model Context Protocol at mcp.fast.io and store files up to 100 GB with built-in semantic search. Monthly plans start with a 14-day free trial that requires a credit card.