Server unexpectedly closed network connection

What “Server unexpectedly closed network connection” usually means

When PuTTY reports Server unexpectedly closed network connection, the client has already attempted a network or protocol step and failed before a normal interactive shell is available. This guide explains what the message usually means on Windows clients, which local settings to verify first, and when the problem is almost certainly on the server, firewall, or DNS path rather than inside the PuTTY GUI.

The SSH server closed the connection without a graceful client-driven logout. Causes range from ForceCommand exits to resource limits and tcpwrappers-style denials after connect.

Independent resource: Putty.info is educational only and is not affiliated with the official PuTTY project. Compare symptoms against the official documentation for your installed version.

Symptoms you will see

Operators usually notice this failure in one of a few repeatable ways. Capture the exact dialog text, the hostname and port from the Session panel, and whether the failure happens before or after a username prompt—those details decide which checklist below applies.

  • Disconnect soon after auth or even right after banner.
  • May succeed briefly then drop.

Likely causes ranked by frequency

Several independent conditions can produce the same client-facing wording. Work from the outside in: reachability first, protocol selection second, authentication third. Changing key files will not fix a TCP refusal, and opening a wider firewall will not fix a rejected public key.

  • Shell or ForceCommand exits immediately.
  • Account restricted /nologin shell.
  • fail2ban or admin scripts killing the session.
  • Resource exhaustion on the server.

Step-by-step client checks

Use this ordered checklist on a workstation you control. Prefer saved sessions so Host Name, Port, and Connection type stay consistent while you isolate one variable at a time.

  1. Note whether failure is pre-auth or post-auth.
  2. Try a different account with a known-good shell.
  3. Ask admins for auth.log/journalctl lines for your user.
  4. Disable experimental remote commands in Plink while testing plain login.
  5. Check disk full and SELinux denials on the server.
  6. Verify you are not being connected to a container that exits when the entrypoint ends.

Do not paste private keys, passphrases, or production passwords into Putty.info tools or contact forms. Diagnose locally with PuTTY, Plink, PSCP, or PSFTP from an official install.

When it is a server or network issue

Inspect ForceCommand, authorized_keys command= restrictions, shells set to nologin, and orchestration health. The client cannot invent a shell the account lacks.

If TCP connects from another network path but fails from yours, involve the network team with traceroute/path evidence rather than repeatedly regenerating keys. If authentication fails after a banner appears, collect the server sshd logs for the same timestamp and username—client-side retries alone rarely reveal AccountLocked, Match blocks, or AllowUsers denials.

Sources

  • PuTTY Documentation — Simon Tatham / PuTTY Project · verified 2026-09-03 04:12:04
  • PuTTY FAQ — Simon Tatham / PuTTY Project · verified 2026-09-03 04:12:04