Debug Messages: Your First Line of Defense

SSH clients and servers have debugging built in. When invoked with appropriate options, these programs emit messages about their progress and failures. You can use these messages to isolate problems.

12.1.1 Client Debugging

Most clients print debug messages when invoked with the -v (verbose mode) option: [7.4.17]

    $ ssh -v server.example.com
    $ scp -v myfile server.example.com:otherfile

So many problems can be identified in verbose mode. This should be your first instinct whenever you encounter a problem.

Tip

Please take a deep breath and repeat after us:

"ssh -v is my friend....”

"ssh -v is my friend....”

"ssh -v is my friend....”

12.1.2 Server Debugging

The OpenSSH and Tectia servers also print debug messages when asked: [5.9]

    # OpenSSH
    $ sshd -d -e

    # Tectia
    $ sshd -v
    $ sshd -d debug_spec

In either case, the server enters a special debugging mode. It accepts a single connection, operates normally until the connection terminates, and then exits. It doesn’t go into the background or create a child process to handle the connection, and it prints information on its progress to the screen (that is, to the standard error stream).

Tectia has a more complicated system for debugging: numeric debugging levels, specified with the -d option, where a higher number means more information. [5.9] In fact, -v for verbose mode is actually just a shorthand for -d2. At higher debug levels, the output is so huge that only SSH developers will likely find it of use in tracking ...

Get SSH, The Secure Shell: The Definitive Guide, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.