Advanced Troubleshooting
Comprehensive guide for diagnosing and resolving connection and transfer issues.
Connection Problems
Cannot Connect to Host
Symptoms
- "Connection refused" error
- "Network is unreachable"
- Timeout waiting for response
Diagnosis Steps
- Verify host is reachable:
ping hostname
- Check SSH port is open:
telnet hostname 22
Or: Test-NetConnection hostname -Port 22
- Verify hostname format:
- No protocol prefix needed:
example.com not ssh://example.com
- Custom port:
example.com:2222
- IPv6:
[::1]:22
- Check firewall rules:
- Windows Firewall may block outgoing SSH
- Corporate firewall may block port 22
- Try alternative port if available
Connection Times Out
Common Causes
- Network latency or packet loss
- Server under heavy load
- Intermediate firewall dropping packets
- MTU issues on network path
Solutions
- Increase connection timeout in settings
- Enable SSH keepalive
- Try from different network
- Contact server administrator
Connection Reset by Peer
Symptoms
- Connection established then immediately closed
- "Connection reset by peer" error
Causes
- Server rejected authentication method
- Max connections exceeded on server
- Server configuration issue
- Incompatible SSH protocol version
Solutions
- Check server logs for rejection reason
- Try different authentication method
- Wait and retry (may be rate limiting)
- Verify server supports SSH 2.0
Authentication Problems
Password Authentication Fails
Check These
- Password is correct (case-sensitive)
- Account is not locked
- Password hasn't expired
- Server allows password authentication
Server Configuration
Some servers disable password auth:
# In /etc/ssh/sshd_config
PasswordAuthentication yes # Must be enabled
Public Key Authentication Fails
Verify Key Setup
- Public key on server:
cat ~/.ssh/authorized_keys
Ensure your public key is present
- Permissions on server:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
- Private key format:
- PEM: OpenSSH format
- PPK: PuTTY format (native conversion)
- Check key file is not corrupted
- Key passphrase:
- Enter when prompted
- Use Pageant to cache unlocked key
PPK Conversion Issues
- PPK v3 requires argon2.dll: Ensure DLL is in plugin directory
- Corrupted PPK: Try opening in PuTTYgen
- Wrong format: Plugin auto-detects, but may fail with unusual keys
Pageant Not Working
Checklist
- Pageant is running (check system tray)
- Key is loaded in Pageant (right-click → View Keys)
- "Use SSH agent (Pageant)" is checked in plugin
- Plugin can communicate with Pageant
Debug Pageant
- Open Pageant key list
- Note key fingerprint
- Enable detailed logging in plugin
- Check which keys plugin sees
- Verify server accepts that key type
SFTP/SCP Problems
SFTP Subsystem Not Available
Symptoms
- "Subsystem request failed"
- "SFTP initialization failed"
Solutions
- Try SCP mode instead
- Enable "Use SCP for everything"
- Enable shell transfer fallback
- Contact admin to enable SFTP subsystem
Server Configuration
# In /etc/ssh/sshd_config
Subsystem sftp /usr/lib/openssh/sftp-server # Must be present
SCP Transfers Fail
Common Issues
- Permissions: No write permission in target directory
- Disk space: Server disk full
- File size: Exceeds server limits
- Filename encoding: Non-ASCII names
SCP Protocol Issues
- Some servers have buggy SCP implementation
- Try "Use SCP for data transfers" (mixed mode)
- Enable shell transfer as fallback
Transfer Speed Slow
Diagnosis
- Check network bandwidth: speed test
- Monitor CPU usage (compression overhead)
- Check server load
- Test with different file sizes
Optimization
- Disable compression: May help on fast networks
- Increase block size: Larger transfers more efficient
- Use binary mode: ASCII conversion adds overhead
- Parallel transfers: Multiple small files
PHP Agent Problems
HTTP 401 Unauthorized
Causes
- Password doesn't match PSK in sftp.php
- An old sftp.php on the server, generated for a different password
- A proxy or CDN in front of the server drops the
X-SFTP-* headers that carry the signature
Solutions
- Regenerate sftp.php with correct password
- Upload new sftp.php to server
- Make sure custom request headers reach PHP unchanged
HTTP 404 Not Found
Check
- URL is correct and complete
- sftp.php exists at that path
- File permissions allow execution
- Web server configured for PHP
Test URL
curl -I https://example.com/sftp.php
Should return HTTP 200 or 401 (not 404)
HTTP 503 Service Unavailable
Meaning
- AGENT_PSK not configured
- sftp.php not properly deployed
Fix
- Set PSK via environment variable:
export AGENT_PSK=your_secret
- Or edit sftp.php constant:
const AGENT_PSK = 'your_secret';
- Re-upload sftp.php
Upload Fails with HTTP 500
Check PHP Limits
upload_max_filesize in php.ini
post_max_size in php.ini
max_execution_time
memory_limit
Check Server Logs
# Apache
tail -f /var/log/apache2/error.log
# Nginx
tail -f /var/log/nginx/error.log
# PHP
tail -f /var/log/php/error.log
Directory Listing Empty
Possible Causes
- AGENT_ROOT set incorrectly
- open_basedir restriction
- Directory permissions
- SELinux/AppArmor blocking
Debug
# Check what PHP sees
php -r "var_dump(scandir('.'));"
Character Encoding Issues
Garbled Filenames
Diagnosis
- Note which characters are wrong
- Check server's default encoding
- Try forcing UTF-8 or ANSI
Solutions
- Set UTF-8 for filenames
- Select correct codepage for ANSI
- Check server SSH configuration
Text File Content Corrupted
Check Transfer Mode
- Binary: Raw bytes (no conversion)
- ASCII: Line ending conversion
- Auto: Based on file patterns
Line Ending Issues
- Windows expects CRLF
- Unix expects LF
- Classic Mac used CR
- Use appropriate mode for target
Proxy Issues
Proxy Connection Fails
Verify Proxy Settings
- Proxy hostname correct
- Proxy port correct
- Proxy type matches server
- Credentials if required
Test Proxy
# HTTP proxy
curl --proxy http://proxy:8080 https://example.com
# SOCKS proxy
curl --socks5 proxy:1080 https://example.com
SOCKS5 Authentication Fails
Check
- Username/password correct
- SOCKS5 selected (not SOCKS4a)
- Proxy supports username/password auth
Logging and Debugging
Enable Detailed Logging
- Check "Detailed log" in plugin settings
- Check "Show entire directory listings in log"
- Reproduce the issue
- Review Total Commander log window
Log Analysis
Connection Log
CONN: Connecting to hostname:22
CONN: Socket connected
CONN: SSH session initialized
CONN: Server banner: SSH-2.0-OpenSSH_8.9
CONN: Userauth list: publickey,password
Transfer Log
XFER: Downloading /remote/file.txt
XFER: Size: 1234567 bytes
XFER: Using SFTP method
XFER: Progress: 50%
XFER: Complete
Network Capture
For advanced debugging, use Wireshark:
- Start capture on network interface
- Filter:
tcp.port == 22
- Reproduce issue
- Stop capture and analyze
Recent Bug Fixes (March 2026)
PHP Agent TAR batch download — 0 files received
Symptom: Downloading multiple files with TAR stream enabled completes without error but writes 0 local files.
Cause: Remote path passed to TarDownloadSessionQueue included the host prefix and script path (e.g. host.example.com/sftp.php/dir/file.txt), so the lookup key never matched the TAR entry names returned by the server.
Fix: NormalizePhpRemotePath is now applied inside TarDownloadSessionQueue before building the lookup map. Update to the latest plugin build.
PHP Agent TAR batch download — HTTP 504 Gateway Timeout (OVH / home.pl)
Symptom: TAR download of large file sets times out with HTTP 504 on shared hosting servers.
Cause: The server-side op_tar_pack buffered the entire TAR archive in php://temp before sending any response bytes. Servers like OVH and home.pl abort PHP scripts that produce no output for several seconds.
Fix: op_tar_pack now streams directly to php://output with output buffering disabled (ob_end_clean, zlib.output_compression=0, X-Accel-Buffering: no). Upload the updated sftp.php from the plugin directory to your server.
PHP Agent TAR upload — silent failure for archives exceeding 4 GB
Symptom: Uploading a large directory whose TAR archive exceeds 4 GB fails silently — no error shown, but files are not transferred.
Cause: WinHttpSendRequest was called with (DWORD)totalTarSize as the dwTotalLength parameter. DWORD is 32-bit; values above 4 294 967 295 bytes wrap around, causing WinHTTP to send a false Content-Length and the server to close the connection mid-stream.
Fix: Content-Length is now added as a 64-bit string to the custom headers and WINHTTP_IGNORE_REQUEST_TOTAL_LENGTH is passed as dwTotalLength. Update to the latest plugin build.
SFTP Resume Not Working
Symptom: Resume upload always starts from beginning instead of last position.
Cause: Missing LIBSSH2_SFTP_ATTR_SIZE flag in fstat request.
Fix: Added flag to request file size from server. Update to latest version.
Setstat After SCP Upload
Symptom: Potential crash when setting timestamps after SCP upload in SCP-only mode.
Cause: Missing null check for sftpsession before calling setstat.
Fix: Added guard to check sftpsession != nullptr. Update to latest version.
Tilde Symlink Downloaded as File
Symptom: Clicking "~" (home symlink) opens download dialog instead of opening folder.
Cause: Stale shell session after PHP→SCP mode switch, TC interpreted FS_EXEC_YOURSELF as "download file".
Fix: Added reconnect+retry logic and safety net in FsGetFileW. Update to latest version.
Diagnostic Log
The plugin keeps no log unless asked to. To record one for a bug report, add DebugLog=1 to the [Configuration] section of sftpplug.ini (or set the environment variable SFTPPLUG_DEBUGLOG=1) and restart Total Commander.
The log goes to %LOCALAPPDATA%\SFTPplug\sftpplug.log, a folder of your own user profile. It leaves out passwords and key material. Remove the setting again once the log is recorded: logging slows transfers down.
Getting Help
Information to Provide
- Plugin version
- Total Commander version
- Windows version
- Server type and version
- Detailed error messages
- Log output (with sensitive data removed)
- Steps to reproduce
Common Error Codes
| Code | Meaning |
| LIBSSH2_ERROR_SOCKET_NONE (-2) | Socket not initialized |
| LIBSSH2_ERROR_BANNER_RECV (-3) | Server banner not received |
| LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE (-4) | KEX failed |
| LIBSSH2_ERROR_TIMEOUT (-10) | Operation timed out |
| LIBSSH2_ERROR_AUTHENTICATION_FAILED (-18) | Auth failed |
| LIBSSH2_ERROR_SFTP_PROTOCOL (-26) | SFTP protocol error |
| LIBSSH2_ERROR_SOCKET_DISCONNECT (-13) | SSH disconnected |
Tip: Many issues are server-side. Check server logs (/var/log/auth.log, /var/log/secure) for SSH daemon messages.
Back to index