Enable Debugging Mode in SSH to Troubleshoot Connectivity Issues

SSH debugging mode is a powerful troubleshooting feature that provides detailed information about SSH connection processes. When connecting to remote servers, enabling verbose mode helps diagnose authentication failures, network connectivity issues, and configuration problems by displaying step-by-step connection details.

By enabling debugging mode in SSH, you can monitor the complete handshake process, view certificate exchanges, examine authentication attempts, and identify where connections fail. This visibility is essential for system administrators managing multiple remote servers.

SSH Verbosity Levels

SSH offers three levels of verbosity, each providing increasing amounts of diagnostic information:

Level Option Description
1 -v Basic debugging information about connection progress and authentication
2 -vv Detailed protocol-level information from both client and server
3 -vvv Maximum verbosity showing all protocol exchanges and internal operations

Enabling SSH Debug Mode

To enable basic SSH debugging, use the -v option with your SSH command:

ssh -v username@hostname

For more detailed troubleshooting, use higher verbosity levels:

ssh -vv username@hostname
ssh -vvv username@hostname

Replace username with your actual username and hostname with the server's IP address or domain name.

Example Debug Output

When debugging is enabled, SSH displays detailed connection information:

OpenSSH_8.9p1, OpenSSL 1.1.1
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to server.example.com [192.168.1.100] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type 0
debug1: Server host key: ssh-rsa SHA256:abc123...
debug1: Host 'server.example.com' is known and matches the RSA host key.
debug1: Authentication succeeded (publickey).

Common Connection Issues

SSH debugging helps identify several common problems:

  • Authentication failures Shows which authentication methods are attempted and why they fail

  • Host key verification errors Displays host key mismatches or unknown hosts

  • Network connectivity issues Reveals connection timeouts or refused connections

  • Configuration problems Shows parsing errors in SSH config files

Security Considerations

When using SSH debug mode, be aware that verbose output may expose sensitive information such as usernames, server details, and authentication attempts. Use debugging only when necessary and avoid logging sensitive sessions to files that others can access.

To exit an SSH session after troubleshooting, simply type:

exit

Conclusion

SSH debugging mode is an essential tool for diagnosing connection problems and understanding the SSH handshake process. The three verbosity levels provide progressively detailed information to help identify authentication, network, and configuration issues. While powerful for troubleshooting, use debug mode carefully to avoid exposing sensitive connection details.

Updated on: 2026-03-17T09:01:38+05:30

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements