Advanced Troubleshooting

Comprehensive guide for diagnosing and resolving connection and transfer issues.

Connection Problems

Cannot Connect to Host

Symptoms

Diagnosis Steps

  1. Verify host is reachable:
    ping hostname
  2. Check SSH port is open:
    telnet hostname 22
    Or:
    Test-NetConnection hostname -Port 22
  3. Verify hostname format:
  4. Check firewall rules:

Connection Times Out

Common Causes

Solutions

Connection Reset by Peer

Symptoms

Causes

Solutions

Authentication Problems

Password Authentication Fails

Check These

Server Configuration

Some servers disable password auth:

# In /etc/ssh/sshd_config
PasswordAuthentication yes  # Must be enabled

Public Key Authentication Fails

Verify Key Setup

  1. Public key on server:
    cat ~/.ssh/authorized_keys
    Ensure your public key is present
  2. Permissions on server:
    chmod 700 ~/.ssh
    chmod 600 ~/.ssh/authorized_keys
        
  3. Private key format:
  4. Key passphrase:

PPK Conversion Issues

Pageant Not Working

Checklist

Debug Pageant

  1. Open Pageant key list
  2. Note key fingerprint
  3. Enable detailed logging in plugin
  4. Check which keys plugin sees
  5. Verify server accepts that key type

SFTP/SCP Problems

SFTP Subsystem Not Available

Symptoms

Solutions

  1. Try SCP mode instead
  2. Enable "Use SCP for everything"
  3. Enable shell transfer fallback
  4. 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

SCP Protocol Issues

Transfer Speed Slow

Diagnosis

Optimization

PHP Agent Problems

HTTP 401 Unauthorized

Causes

Solutions

  1. Regenerate sftp.php with correct password
  2. Upload new sftp.php to server
  3. Make sure custom request headers reach PHP unchanged

HTTP 404 Not Found

Check

Test URL

curl -I https://example.com/sftp.php
Should return HTTP 200 or 401 (not 404)

HTTP 503 Service Unavailable

Meaning

Fix

  1. Set PSK via environment variable:
    export AGENT_PSK=your_secret
  2. Or edit sftp.php constant:
    const AGENT_PSK = 'your_secret';
  3. Re-upload sftp.php

Upload Fails with HTTP 500

Check PHP Limits

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

Debug

# Check what PHP sees
php -r "var_dump(scandir('.'));"

Character Encoding Issues

Garbled Filenames

Diagnosis

Solutions

Text File Content Corrupted

Check Transfer Mode

Line Ending Issues

Proxy Issues

Proxy Connection Fails

Verify Proxy Settings

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

Logging and Debugging

Enable Detailed Logging

  1. Check "Detailed log" in plugin settings
  2. Check "Show entire directory listings in log"
  3. Reproduce the issue
  4. 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:

  1. Start capture on network interface
  2. Filter: tcp.port == 22
  3. Reproduce issue
  4. 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

Common Error Codes

CodeMeaning
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