Using PuTTY Session Logging to Debug SSH Connections
Learn how to enable PuTTY's built‑in session logging, choose the right detail level, manage log files, and use the logs to troubleshoot SSH connections while avoiding common pitfalls.
13 Feb 2026, 14:55 UTC

Enabling logging in PuTTY
Open PuTTY, load or create a session, then choose Session → Logging from the category list.
Choosing a logging mode
In the Logging panel you can select one of three options:
- Printable output – only characters that appear in the terminal.
- All session output – includes control characters and escape sequences, useful for debugging terminal emulation.
- SSH packets – logs the raw SSH protocol exchange.
Managing log files
Specify a full path for the log file, for example C:\logs\putty_session.log. By default PuTTY appends to an existing file. To start with a clean file each time you launch a session, check Always overwrite the existing log file. Ensure the account running PuTTY has write permission to the chosen directory.
Worked example: capturing a simple command
- Launch PuTTY, load your SSH session, go to Session → Logging.
- Select All session output.
- Enter a log file path, e.g., /home/user/logs/ssh_debug.log (adjust for your OS).
- Leave the overwrite option unchecked if you want to keep a history, or check it for a fresh log each connection.
- Click Open to start the SSH connection.
- Once logged in, run a harmless command such as ls -l.
- Close the session.
- Open the log file with a text editor or cat and verify that the command you typed and the server's response appear, including any control characters if you chose All session output.
Required permissions: the user must be able to write to the log file directory. Risks: the log may contain passwords if you type them; avoid entering sensitive credentials while logging is enabled. Large outputs can quickly fill disk space, especially with SSH packets mode.
Trade‑offs and limitations
- Logging everything (All session output or SSH packets) can generate large files; monitor file size or use log rotation.
- Sensitive data such as passwords, private keys, or authentication tokens appear in plain text in the log; store logs in a secure location and delete them after troubleshooting.
- Logging does not affect the SSH connection itself; it is purely observational, so enabling it will not change server behavior.
Practical way to check the result: after a session, compare the log file size before and after the connection; a non‑zero increase indicates data was captured. Additionally, grep for a known string you sent (e.g., the command) to confirm presence.
Actionable closing
When you need to diagnose an SSH issue, enable PuTTY logging, choose the detail level that matches your problem, secure the log file, and review it after the session. Remember to disable logging or clear the log file for routine use to avoid unnecessary disk consumption and exposure of confidential information.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.