You are working remotely from India — editing code on a cloud VM or home server. VS Code Remote SSH connects, you start editing, and 10–15 minutes later the connection silently drops. You reconnect, lose your terminal session, and the language server reindexes. This happens multiple times a day on BSNL broadband, Airtel Fiber during peak hours, or Jio Fiber with congestion. The root cause is SSH timeout on intermittent connectivity, and two SSH config parameters fix it.
How VS Code Remote SSH works and why it drops on slow ISPs
VS Code Remote SSH opens an SSH connection to the remote server, runs a VS Code server process there, and your local VS Code communicates with it over the SSH connection for file browsing, terminal sessions, and language server completions. The SSH connection uses keep-alive packets to detect liveness. If no data is exchanged for more than the server's idle timeout (typically 60–180 seconds on default OpenSSH settings), the server closes the connection.
Indian ISPs during peak hours and monsoon season introduce packet loss and latency spikes. A 5-second latency spike can delay an SSH keep-alive response past the server's timeout window. The server closes the connection, VS Code loses the remote session, and reconnection takes 10–30 seconds, during which your terminal session is lost.
Fix 1: Configure SSH keep-alive and connection multiplexing
Open or create your SSH config file. On macOS/Linux: nano ~/.ssh/config. On Windows: notepad %USERPROFILE%\.ssh\config. Add:
Host * ServerAliveInterval 30 ServerAliveCountMax 6 ControlMaster auto ControlPersist 10m ControlPath ~/.ssh/control-%h-%p-%r Compression yes TCPKeepAlive yes
Parameter explanations:
- ServerAliveInterval 30 — sends keep-alive every 30 seconds from the SSH client.
- ServerAliveCountMax 6 — retries 6 times (3 minutes total tolerance) before closing.
- ControlMaster auto — one master SSH connection per host; all VS Code sessions reuse it.
- ControlPersist 10m — keeps the master connection alive for 10 minutes. VS Code reconnects in milliseconds.
- Compression yes — reduces SSH bandwidth 30–50% for text-heavy sessions.
After saving, reload the Remote SSH extension: Ctrl+Shift+P → Remote-SSH: Kill VS Code Server on Host, then reconnect.
Fix 2: VS Code settings for slow connections
Open VS Code settings (Ctrl+, or Cmd+,). Set remote.SSH.connectTimeout to 30. Open settings.json (Ctrl+Shift+P → Open User Settings JSON) and add:
"remote.SSH.connectTimeout": 30,"remote.SSH.enableDynamicForwarding": false
Also add files.watcherExclude patterns for large directories like node_modules and .git to reduce file watch traffic over SSH.
Fix 3: Configure the SSH server side
If you have access to the remote server, edit /etc/ssh/sshd_config:
ClientAliveInterval 30ClientAliveCountMax 10
Restart sshd: sudo systemctl restart sshd. The server now sends keep-alive every 30 seconds and tolerates 5 minutes of unresponsive client before closing.
India-specific ISP context
Typical Indian broadband for Remote SSH:
- Airtel Fiber: 8–15 ms to domestic AWS/Azure endpoints, reliable but peak-hour congestion (8–11 PM).
- Jio Fiber: Similar latency, slightly more packet loss in dense urban areas at peak hours.
- BSNL: 15–30 ms to domestic endpoints, higher variance, susceptible to monsoon weather.
- Airtel 5G: Low latency but variable — cell handoffs during mobility cause brief interruptions.
Wired Ethernet is the single biggest improvement you can make for Remote SSH stability. USB-C to Ethernet adapters cost ₹500–₹1,500. Also check your router's NAT timeout — some routers close TCP connections idle for more than 30 seconds. Set the router's TCP timeout to at least 300 seconds.
When hardware is the issue
If Remote SSH is stable but the laptop freezes or becomes unresponsive, the issue is RAM pressure. A modern development workflow — VS Code with language server, multiple terminals, browser with documentation — can consume 6–8 GB of RAM. On an 8 GB laptop, this causes the OS to swap aggressively to the SSD, which appears as a VS Code hang. Our RAM upgrade service addresses this. Cost: ₹1,500–₹3,500.
A note from the LRW Engineer Team
ControlPersist + ServerAliveInterval is the single most impactful SSH config change for developers in India. After applying these settings, Remote SSH stays connected through 5-minute ISP outages. The setup takes under 5 minutes. WhatsApp us at 7702503336 if you need help identifying whether the issue is on the laptop, router, or ISP side.