SSH Debug Mode
You enable ssh debug mode by raising the log level on your client or server. This shows step-by-step login messages so you can find and fix broken logins. Teams often turn on verbose output when keys or user roles fail to match. When teams grant broad server permissions to bypass these errors, they create big security risks. How ssh debug mode works in OpenSSH When a user tries to log in, the client and server trade messages. Normally, the tool hides these steps and only shows a pass or fail
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You enable ssh debug mode by raising the log level on your client or server. This shows step-by-step login messages so you can find and fix broken logins. Teams often turn on verbose output when keys or user roles fail to match. When teams grant broad server permissions to bypass these errors, they create big security risks.
How ssh debug mode works in OpenSSH
When a user tries to log in, the client and server trade messages. Normally, the tool hides these steps and only shows a pass or fail alert. Turning on ssh debug mode prints every step of the login flow to your screen. You can see which keys the client offers and how the server checks them.
Many teams use OpenSSH certificates to manage user and host logins at scale. A Certification Authority key signs a public key to make a valid certificate. This file holds a public key, identity info, principal names, and a set of options. OpenSSH certificates use a much simpler format than X.509 certificates.
When a login fails, debug output shows if the principal name matches the target user. It also shows if the server trusts the signing Certification Authority key. You can run the server daemon in a test mode on a separate port. This lets an admin read the server log output for one login attempt.
The client and server both allow multiple levels of debug detail. Low levels show high-level steps like key checks and host matching. High levels dump raw packet data and internal state changes during the handshake. Engineers read these lines from top to bottom to spot the exact failure point.
Why debug logs stop at the login door
Verbose login output is great for fixing broken keys or bad file permissions. It tells you why a user could not open a shell on a host. Still, native debug logs only care about the initial handshake and login check. Once the session starts, the login log does not track what the user runs.
Debug logs decide who logs in, not what commands do in flight. If you turn up server logging to watch active sessions, you create new risks. High debug levels on a server can print sensitive data into plain text log files. Anyone with read rights on those host logs might see private session details.
SSH Access Management: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Also, local host logs are hard to collect and protect across many machines. An engineer with root rights on a box can edit or delete local log files. Teams often use a bastion or jump host to funnel traffic through one place. Even then, standard OpenSSH logs do not inspect or block risky shell commands in flight.
What to check during a failed login
Start on the client side before you change any server settings. Client output shows which local key files the tool tries to read first. It also reveals if local key files have broad read permissions that OpenSSH rejects. If the client skips a key, permissions on your home folder might be too open.
Next, check how the client picks a login method with the remote host. The server sends a list of allowed methods like public key or password. If your certificate fails, check the principal names and options baked into that file. Matching the right user name and key identity fixes most login blocks fast.
Add command and file guardrails to SSH access
Host firewalls and certificate principals control who opens an SSH session. Yet an allowed user or agent can still run a bad one-shot command or pull sensitive files over sftp. In practice, hoop.dev provides an open-source SSH server with guardrails on the host that uses OpenSSH certificates.
Using hoop.dev SSH controls, guardrails check one-shot commands, env variable names, and sftp or scp paths before they run. Port forwards default to deny unless the target is listed. Because interactive shells have no statement boundary and carry no guardrails, teams can turn them off so every command is checked and logged. Check out the MIT-licensed project on GitHub.
Frequently asked questions
Does ssh debug mode slow down active server sessions?
High debug levels print many lines of text for every packet sent. This extra work can slow down file transfers, so turn it off after testing.
Is it safe to leave server debug logging on in production?
No, high server log levels can write private user data to disk. Only use verbose server logs for short tests when fixing a login bug.
Can client debug output show why a server rejected a key?
Client logs only show that the server said no to a specific key. You must check the server logs to see the exact reason for that rejection.
Related guides
In this post