Debugging in Linux - dummies

By Emmett Dulaney

Nearly every Linux service has an option allowing it to run in a debug level(s). By turning on debugging, you can see everything from failure messages to detailed information on what the service does. Usually, you can either add a debug option to an init script (often passed by options set in /etc/sysconfig files) or run a daemon process manually from the shell with debug options added. For example:

# /usr/sbin/sshd -ddd -f /etc/ssh/sshd_config -p 12345

This example starts the secure shell daemon (sshd) in maximum debug mode (-ddd). It uses the sshd_config for its configuration and listens for connections on port number 12345. This port is just being used for testing purposes, so not to conflict with any common ports. Watch the debug messages appear in the Terminal window. Next you could have an ssh client from another computer try to connect to this server:

$ ssh -l testuser -p 12345

Assuming here that the server’s IP address is, this example attempts to connect to the sshd server run earlier on port 12345. It tries to log in as the user named testuser. By watching sshd debug messages, you can check that the client can communicate with the server and that the configuration file is working properly.