When dealing with multiple stale PuTTY sessions after system resume, the modal "Fatal Error" dialog becomes a significant workflow blocker. Each disconnected session requires manual dismissal:
[Window Title] PuTTY Fatal Error [Content] Network error: Software caused connection abort [OK]
The native solution involves modifying PuTTY's configuration settings. Create or modify a session with these parameters:
# In your saved session settings (or Default Settings) HostName example.com Protocol ssh CloseOnExit 1 WarnOnClose 0 SuppressErrorDialogs yes
For versions without GUI options, directly modify Windows Registry:
Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings] "SuppressErrorDialogs"=dword:00000001 "WarnOnClose"=dword:00000001
Use PowerShell to programmatically close stale sessions:
Get-Process putty | Where-Object { $_.MainWindowTitle -match "Inactive" } | ForEach-Object { # Send Alt+F4 to each window Add-Type -AssemblyName System.Windows.Forms [System.Windows.Forms.SendKeys]::SendWait("%{F4}") }
For permanent solutions, consider modifying PuTTY's source (windows.c):
/* Original code showing dialog */ if (flags & MB_ICONERROR) { MessageBox(hwnd, msg, "PuTTY Fatal Error", flags); } /* Modified silent version */ if ((flags & MB_ICONERROR) && !cfg->suppress_err_dialogs) { MessageBox(hwnd, msg, "PuTTY Fatal Error", flags); }
- Use persistent connections with
tmux
orscreen
- Configure SSH keepalives (Add
ServerAliveInterval 60
to ~/.ssh/config) - Consider alternative clients like KiTTY with native session management
When working with multiple remote servers via PuTTY, it's common to accumulate inactive sessions after system sleep/resume cycles. While Windows allows bulk-closing applications from the taskbar, PuTTY's fatal error dialog ("Network error: Software caused connection abort") creates a modal barrier that forces manual handling of each session.
PuTTY doesn't expose this setting in its GUI, but we can modify the Windows Registry to suppress fatal errors:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY]
"SuppressErrorPopups"=dword:00000001
For scripted launches, use these PuTTY command-line options:
putty.exe -ssh user@host -no-antispoof -pw password
The -no-antispoof
parameter prevents some (but not all) error dialogs from appearing.
Create a PowerShell script to clean up inactive PuTTY processes:
$puttyProcesses = Get-Process | Where-Object {
$_.MainWindowTitle -match "PuTTY.*$Inactive$"
}
$puttyProcesses | ForEach-Object { $_.CloseMainWindow() }
If you want to maintain the close confirmation while suppressing fatal errors, modify PuTTY's configuration file:
; ~/.putty/sessions/Default%20Settings
WarnOnClose=1
SuppressErrors=1
For heavy terminal users, consider clients with better session management:
- KiTTY (PuTTY fork with enhanced features)
- Windows Terminal with OpenSSH
- MobaXTerm (tabbed interface with session persistence)