Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
VGSources
Blog

How to Fix SFTP Connections That Keep Disconnecting

Classify the timing first: idle-only SFTP drops usually involve expired NAT or firewall state, while active-transfer failures require endpoint, path, and server-log investigation. This guide shows how to collect evidence, tune OpenSSH keepalives, and isolate the cause without weakening host security.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

First determine when the SFTP session drops. A disconnect that happens only after inactivity usually means a firewall, NAT device, VPN, or load balancer expired idle TCP state. A disconnect while files are actively transferring points instead to the endpoint, network path, server policy, resource limits, or SFTP subsystem. Capture client verbosity, server logs, and network-device events at the same UTC time before changing settings. Then use OpenSSH keepalives below the shortest idle timeout on the path.

Classify the disconnect before changing anything

Write down the exact elapsed time, whether the session was idle or transferring data, and what the client displayed. This single distinction prevents the most common wrong fix: adding keepalives to a connection that is actually failing because of a server crash, packet loss, authentication policy, or an exhausted resource.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Observed pattern Most useful first hypothesis What to check next
Drop after a repeatable idle period A packet filter, NAT device, VPN, or load balancer expired inactive TCP state. Path idle timers, keepalive traffic, and firewall/NAT logs.
Drop while bytes are moving Endpoint, path, server policy, resource, or SFTP-subsystem problem. Client debug output, sshd/SFTP logs, resets, disk and process health.
Drop at the same file or operation every time An application-level limit, permission problem, subsystem error, or server-side resource issue. Server logs for that account, path, file, and operation.
Only one network fails The failing network’s NAT, firewall, VPN, or wireless path. Repeat from a wired connection and a mobile hotspot, then compare timestamps.
Every network and client fails A common server, account, host, or SFTP subsystem fault. Server-side logs, limits, service health, and account restrictions.

The OpenSSH FAQ describes an idle-only failure as usually caused by “a packet filter or NAT device timing out your TCP connection due to inactivity.” That diagnosis is plausible, not automatic: confirm it with timestamps and device logs.

Collect evidence from all three layers

Client-side trace

Reproduce the problem with the OpenSSH client at high verbosity and save the output with UTC timestamps:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
sftp -vvv user@host

For a repeatable test, redirect output to a file and record when the transfer starts, when it becomes idle, and when the failure appears. The final event may be an SSH disconnect, a TCP reset, an authentication failure, or a local timeout. Those outcomes lead to different fixes.

Server-side logs

At the same UTC time, inspect the SSH daemon and SFTP-subsystem logs. Look for session termination, account restrictions, forced commands, authentication events, subsystem crashes, resource errors, and administrator-initiated disconnects. Log locations and service names vary by operating system and packaging, so use the platform’s configured sshd journal or log files rather than assuming one path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Network and intermediary logs

Check the firewall, NAT gateway, VPN concentrator, reverse proxy, and load balancer carrying the connection. Correlate connection tracking expiry, policy drops, TCP resets, idle-timeout events, and tunnel renegotiations with the client and server timestamps. A network device that silently expires state may leave no SSH-level reason code; its own event log is often the only confirmation.

What an SSH disconnect code tells you

SSH runs over a transport such as TCP and defines machine-readable disconnect reason codes. RFC 4253 assigns SSH_DISCONNECT_CONNECTION_LOST decimal reason code 10; the IANA registry represents the same value as 0x0000000A. The code confirms that the SSH transport was lost, but it does not identify whether a client process, server process, firewall, NAT device, VPN, or physical path caused the loss. Treat it as a symptom to correlate with the other logs, not as a diagnosis.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

How OpenSSH keepalives work

OpenSSH has two separate SSH-layer mechanisms. The client sends probes with ServerAliveInterval; the server sends probes with ClientAliveInterval. Each uses a companion count setting to decide how many unanswered probes are tolerated. These messages travel inside the encrypted SSH channel, unlike ordinary TCP keepalives.

Setting Configured in Meaning When disconnect occurs
ServerAliveInterval OpenSSH client configuration or sftp -o option After this many seconds with no data received from the server, the client sends an encrypted request. Only after the client has sent the number of unanswered probes allowed by ServerAliveCountMax.
ServerAliveCountMax OpenSSH client configuration or command line Maximum unanswered server-alive requests the client accepts. After the limit is reached, the client closes the connection.
ClientAliveInterval Server sshd_config After this many seconds with no data received from the client, sshd sends an encrypted channel request. Only after the number of unanswered requests allowed by ClientAliveCountMax.
ClientAliveCountMax Server sshd_config Maximum unanswered client-alive requests the server accepts. sshd terminates the session when the count is exceeded.

OpenSSH’s documented example uses a 15-second ServerAliveInterval and the default count of 3. If the peer is unresponsive, the client disconnects after approximately 45 seconds. The exact elapsed time can vary with scheduling and network behavior, so use the product of interval and count as an planning estimate, not a stopwatch guarantee.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

SSH keepalives versus TCP keepalives

SSH-level probes are carried through the encrypted channel and are not spoofable by an intermediary that cannot authenticate as an SSH endpoint. TCP keepalives are a separate transport feature and can be spoofed; they also depend on operating-system TCP settings. For an SFTP session, configure the OpenSSH options when you need an encrypted application-level liveness check. Do not assume that enabling a kernel TCP keepalive changes OpenSSH’s ServerAliveInterval behavior.

Configure the OpenSSH client

Use a one-time command-line test

Apply options to one reproduction before changing a user’s permanent configuration:

Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
sftp -o ServerAliveInterval=30 -o ServerAliveCountMax=3 [email protected]

This example sends an encrypted probe after 30 seconds without received data and gives the client three unanswered probes. It is a starting point only; the interval must be shorter than the shortest idle timeout on the route, and the count must match how quickly your operation should declare the peer dead.

Set a host-specific profile

Put the settings in the user’s SSH configuration so they apply only to the affected endpoint:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Host example-sftp
    HostName sftp.example.com
    User transfer-user
    ServerAliveInterval 30
    ServerAliveCountMax 3

Keep the profile host-specific instead of applying an aggressive value to every SSH connection. A very short interval creates extra traffic and can cause a healthy but slow peer to be declared dead sooner than intended. A very large count keeps a dead session open longer, which may delay job retry or failover.

Confirm which values OpenSSH will use

Use the effective-configuration view before testing:

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
ssh -G example-sftp

Check that the output contains the expected serveraliveinterval and serveralivecountmax. An included configuration file, a more-specific Host block, or a command-line option can override the value you edited.

Configure the server deliberately

On the server, review the corresponding directives in sshd_config:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ClientAliveInterval 30
ClientAliveCountMax 3

The server sends a request after receiving no data from the client for the configured interval. If the client does not answer within the configured count, sshd ends the session. This is useful when the server must detect clients that have disappeared, but it does not repair a broken path or a stalled SFTP process.

  1. Edit the active sshd configuration, including any files loaded by an Include directive.
  2. Validate syntax with the platform’s sshd configuration test command, commonly sshd -t, before reloading.
  3. Reload the SSH service using the operating system’s service manager so existing sessions are not needlessly terminated.
  4. Open a new test session and verify the effective server values in the daemon’s startup or diagnostic output.
  5. Coordinate the values with provider policies, account-level session limits, VPN timers, and load-balancer idle timers.

Do not lower counts or intervals simply to make a failure appear faster. Choose the maximum outage-detection window your transfer process can tolerate, then ensure the interval still precedes the shortest middlebox idle timeout.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose values from the path, not from a template

Find the shortest idle timeout among every device between client and server. Set the relevant SSH interval below that threshold, with enough margin for scheduling and temporary delay. For example, if a known intermediary expires a connection after 10 minutes of inactivity, a 30- or 60-second interval is comfortably below it; if the shortest timeout is unknown, begin with a conservative test value and confirm that the intermediary sees the probes.

The count controls a different decision: how long to wait before declaring an unresponsive peer dead. With an interval of 30 seconds and a count of 3, the planned detection window is about 90 seconds. A count of 1 detects failure sooner but is less tolerant of a single lost probe; a higher count tolerates transient loss but leaves dead sessions around longer. Document the chosen window so operators know when an automated retry should begin.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When keepalives will not fix the problem

Keepalives preserve an otherwise idle SSH channel and improve detection of an unresponsive peer. They cannot repair packet loss, a crashed server, a stopped SFTP subsystem, exhausted disk or memory, authentication-policy failures, account restrictions, or a path that resets active TCP traffic. They can also mask a capacity problem by keeping abandoned sessions alive longer.

Active-transfer failures

If the session drops while bytes are continuously moving, first verify whether the client saw a TCP reset, an SSH disconnect, or an application error. Inspect server resource limits, filesystem errors, account quotas, process limits, and SFTP-subsystem health. Check whether a VPN or load balancer renegotiates or reaps long-running flows. Increasing ServerAliveInterval does not address a failure that occurs while data is already crossing the channel.

Failures at one operation or file

A repeatable failure at the same path can indicate permissions, a forced command, a server-side policy, a filesystem problem, or an SFTP subsystem exception. Compare the client operation with the server log entry at the same second. Do not infer a network timeout solely from the fact that the client reports a lost connection after an application-level error.

Isolate the middlebox from the endpoint

  1. Repeat the same transfer from the original network and record the idle duration or transfer point at which it fails.
  2. Repeat from a materially different path, such as a wired office connection versus a mobile hotspot.
  3. If possible, use a second SFTP client while keeping the same server account and file operation.
  4. Compare the results. A failure confined to one path and one idle duration strongly prioritizes that path’s NAT or firewall timeout. A failure at the same point from every path prioritizes the server, account, or subsystem.
  5. Correlate each reproduction with client verbosity, sshd logs, and intermediary events in UTC.

Keep host-key verification enabled during every test. Disabling authentication safeguards can hide a separate security problem and does not repair transport state.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read the common failure signatures

Client symptom Interpretation to test Next action
No data, then a disconnect after nearly the same number of minutes Idle state expired in a NAT, firewall, VPN, or load balancer. Set an SSH interval below that timeout and verify keepalive packets in device logs.
SSH_DISCONNECT_CONNECTION_LOST or reason code 10 The SSH transport was lost; the code does not identify the culprit. Compare TCP events, server logs, and path changes at the same UTC timestamp.
Immediate TCP reset during transfer An endpoint or intermediary actively rejected the flow. Inspect firewall policy, server process health, VPN events, and resource exhaustion.
Authentication or authorization error before transfer Not an idle keepalive problem. Fix credentials, host-key policy, account restrictions, or server authorization.
Only one client implementation fails Client-specific configuration, subsystem request, or compatibility issue. Compare effective options and reproduce with another client without weakening host-key checks.

A repeatable repair runbook

  1. Record the activity state, elapsed time, endpoint, account, network path, and exact client message.
  2. Run sftp -vvv and save timestamped output.
  3. Collect sshd/SFTP logs and firewall, NAT, VPN, and load-balancer events for the same UTC window.
  4. Classify the event as idle-only, active-transfer, operation-specific, or authentication-related.
  5. For idle-only drops, identify the shortest middlebox timeout and set ServerAliveInterval or ClientAliveInterval below it.
  6. Choose ServerAliveCountMax or ClientAliveCountMax to meet the required dead-peer detection window.
  7. Test first with command-line overrides, then place the verified values in a host-specific client block or coordinated server configuration.
  8. Reproduce from a second network and, if available, a second client.
  9. If active transfers still fail, stop tuning keepalives and investigate server resources, account policy, subsystem health, packet loss, resets, and intermediary events.
  10. Document the final interval, count, path, and observed failure signature so future incidents can be compared rather than guessed at.

Practical settings checklist

  • Use encrypted OpenSSH keepalives when the problem is an idle SSH channel.
  • Keep the interval shorter than the shortest confirmed or suspected idle timeout.
  • Use the count to define how long an unresponsive peer may remain before disconnect.
  • Remember that client and server directives are independent; changing one side does not automatically change the other.
  • Do not treat TCP keepalive as equivalent to SSH-level keepalive.
  • Do not expect keepalives to cure active-transfer failures, server crashes, authentication failures, or resource exhaustion.
  • Correlate client, server, and network evidence in UTC before assigning blame.
  • Retain host-key checking and normal authentication safeguards throughout testing.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.