Received Unexpected End-of-File from SFTP Server: Fix SFTP EOF Errors

“Received unexpected end-of-file from SFTP server” means the SFTP conversation ended before the client expected it to. First locate the boundary—transport/authentication, subsystem request, account-specific Match/ForceCommand/chroot, or an established session that dies later. Then inspect the effective configuration for the failing connection context, not just a Subsystem line copied from another server.

OpenSSH · SFTPFileZilla / WinSCP / CLILast reviewed Sep 27, 2026
🎯 This guide matches when:
Your SFTP client reports “Received unexpected end-of-file from SFTP server” or an equivalent fatal EOF during SFTP startup/session.SSH may authenticate successfully but SFTP closes immediately, or a GUI client connects and then fails.You administer the OpenSSH server and want a reversible path before editing or reloading sshd configuration.
Find the failure boundary first
SSH itself cannot authenticate/connectFix SSH reachability or authentication first. The SFTP subsystem has not yet been proven as the failing layer.
SSH works; SFTP closes immediatelyReproduce with OpenSSH SFTP, then inspect the effective SFTP subsystem and account restrictions.
Only one GUI client failsCompare with another SFTP client before changing server configuration.
SFTP starts, then EOF occurs laterDo not assume the Subsystem line is wrong; capture server/client logs around the later failure.
Difficulty: ModerateRisk: Server config — validate before reload
🔎 Quick Check — reproduce outside the GUI client

From a machine with the OpenSSH client, retry the same account with verbose SFTP output.

sftp -vvv user@server

Verify: Note whether authentication fails, the connection closes when the SFTP subsystem is requested, or the SFTP prompt appears and EOF happens later. That boundary determines the next branch.

ADSENSE · reserved slot after the first useful step

Why the same SFTP EOF message can have different causes

OpenSSH's Subsystem directive maps a subsystem name such as sftp to a command. OpenSSH supports the external sftp-server program and the in-process internal-sftp server. The correct configuration depends on the server environment; there is no universal external binary path.

That distinction matters in current vendor cases. cPanel documents an EOF caused by a missing SFTP subsystem line, while Plesk documents an EOF where its environment required a different subsystem configuration. Plesk also documents access restrictions that can terminate an SFTP login. Treat those as examples of root causes—not interchangeable fixes.

Fix path #1 — SSH works but SFTP dies immediately

Inspect the configured SFTP subsystem without changing it first:

grep -RniE '^[[:space:]]*(Subsystem|Match|ForceCommand|ChrootDirectory)[[:space:]]' /etc/ssh/sshd_config /etc/ssh/sshd_config.d 2>/dev/null

Look for a missing Subsystem sftp, an external target that is invalid for this environment, and user/group-specific Match, ForceCommand, ChrootDirectory or included configuration that changes behavior after authentication. Remember that grepping files shows configuration text; it does not by itself prove which directives are effective for this account/address context.

Where supported, use OpenSSH's effective-configuration output with the appropriate connection criteria (for example user/host/address values) to confirm the settings that actually apply. Keep the raw config and effective result together when Match or Include is involved.

Verify: If an external SFTP server is configured, prove that the target is usable in the context where it will execute. With chroot designs, a path existing in the host namespace alone may not establish that the required external program/runtime is available inside the jail. Do not copy a path from another distribution or panel merely because the error text matches.

Fix path #2 — choose the subsystem variant for this server

OpenSSH permits either an external sftp-server command or internal-sftp. For example, Debian currently packages an external path under /usr/lib/openssh/sftp-server, while cPanel's documented case uses /usr/libexec/openssh/sftp-server. Plesk has current cases where its supported resolution uses internal-sftp, and other Plesk chroot configurations where the external subsystem is required.

🟡 Do not paste a universal Subsystem line. Identify your OS/control panel/chroot design and follow its supported configuration. Switching subsystem implementations can change chroot behavior or access semantics.

Verify: After deciding on a supported change, validate the entire sshd configuration before applying it. If validation fails, do not reload SSH.

Validate before reloading SSH

Keep the current administrative SSH session open while testing. Validate the configuration first:

sudo sshd -t

If the command reports an error, correct that error before any reload. If it exits cleanly, use the service-management command appropriate to your distribution or hosting panel to reload sshd. Keep the existing administrative session open. From a separate connection, test both normal SSH administration (if expected for that account/context) and SFTP using the exact affected account/path before closing the known-good session.

Verify: The new connection reaches the expected authentication/session state, the affected account reaches an SFTP prompt, and the original operation no longer dies at the same stage. A successful reload alone is not proof that account-specific SFTP behavior is correct.

If the subsystem looks valid: check access, Match and chroot rules

A valid global Subsystem line does not prove a specific account can start SFTP. Inspect the effective Match, ForceCommand, chroot and panel-access state for the failing account/context. Compare with a known-good account only when both are expected to follow comparable policy; different groups or Match criteria can intentionally produce different effective configurations.

Do not remove ChrootDirectory or recursively loosen permissions as a diagnostic shortcut. Chroot ownership and writeability rules are security-sensitive.

Verify: Test the affected account and, if available, a known-good account. A per-user difference is useful evidence that the global SFTP service itself is not the only layer involved.

If SFTP starts and EOF happens later

If you reach an SFTP prompt or begin transferring files before the EOF, a missing global subsystem line is a poor fit for that symptom. Capture the client transcript and server-side SSH/SFTP logs at the timestamp of the disconnect. Also check the resource involved in the failing operation—path/permissions, storage, chroot contents, process termination, or another server-side event—rather than repeatedly rewriting the subsystem.

Verify: Reproduce one small operation and correlate its timestamp with server logs. The goal is to identify what ended the established session.

What not to do first

Do not replace every Subsystem line with a path copied from another Linux distribution.Do not blindly switch between internal-sftp and external sftp-server; hosting-panel and chroot behavior can differ.Do not restart or reload sshd after editing configuration until sshd -t passes.Do not close your only working administrative SSH session before a new connection is verified.Do not remove chroot/access controls or recursively relax permissions just to make SFTP connect.Do not call this a FileZilla or WinSCP defect merely because that client displays the EOF.Do not assume grepping sshd_config reveals the effective account configuration when Include/Match criteria are involved.Do not treat an external sftp-server path existing on the host as proof it is executable/available inside a chrooted runtime context.Do not close the known-good administrative session merely because sshd -t and reload succeed; verify a separate new connection first.Do not keep diagnosing the Subsystem line if SFTP reaches a prompt and the failure moves to a later file/path/operation stage.

Still not fixed? Capture this evidence

Before escalating, record:the exact client error and where in the session it occursthe relevant sftp -vvv lines around subsystem request/disconnect, with secrets and host details redactedserver OS/distribution, OpenSSH version and hosting panel if anythe effective Subsystem, Match, ForceCommand and ChrootDirectory configuration relevant to the accountwhether the configured external sftp-server path existsthe result of sshd -tserver log entries at the same timestampwhether another SFTP account or client reproduces the failureeffective sshd settings for the failing user/host/address context when Match/Include rules applywhether an external subsystem is actually usable inside the applicable chroot/runtime contextwhether the same exact account succeeds in a fresh session after reloadthe first different server/client error if the session progresses beyond the original EOF stage

References

Still stuck? Ask the community

Share the redacted SFTP error, failure stage, server OS/OpenSSH version, subsystem type and whether plain SSH works.

Keep it safe: never post passwords, private keys, public IPs/hostnames you need kept private, tokens, or unredacted authentication logs.
Powered by GitHub DiscussionsSign in with GitHub to comment. Reading comments does not require sign-in.

Loading community discussion…