How to Run SSH in Verbose Mode on Ubuntu
This article explains how to run the SSH client in verbose mode on Ubuntu Linux to troubleshoot and debug connection issues. By enabling verbose logging, you can view the step-by-step handshake process, authentication attempts, and configuration errors that may be causing your SSH connection to fail.
To enable verbose mode in the Ubuntu SSH client, you use the
-v option. SSH supports three levels of verbosity, with
each additional v providing deeper debugging details.
Level 1 Verbosity (-v)
This level prints basic debugging messages about the connection progress. It is useful for identifying general connection stages and seeing which authentication methods are being tried.
ssh -v username@hostnameLevel 2 Verbosity (-vv)
This level displays more detailed information, including local and remote port forwarding details, cryptographic socket interactions, and channel activity.
ssh -vv username@hostnameLevel 3 Verbosity (-vvv)
This is the most detailed debug mode. It outputs extensive tracing data, which is highly useful for diagnosing complex SSH configuration issues, private key mismatches, or server-side restrictions.
ssh -vvv username@hostnameKey Areas to Analyze in the Verbose Output
When troubleshooting your connection, pay close attention to these specific stages in the output:
- Connection Establishing: If the output stops at
Connecting to..., the issue is likely a network problem, an incorrect IP/port, or a firewall blocking port 22. - Key Exchange: Messages containing
SSH2_MSG_KEXINITindicate the key exchange process. If the connection drops here, there is a mismatch between the encryption ciphers supported by the client and the server. - Identity Files: Look for lines starting with
Offering public keyorTrying private key. This shows which SSH keys your client is presenting to the server and whether they are being rejected. - Authentication Allowed: The line
Authentications that can continuelists the authentication methods (such aspublickeyorpassword) that the remote server currently accepts.