Debugging the Server
The server can be debugged by using either the
-d option launches the server to one-shot mode. In this mode, the server accepts only one connection and exits after the session is disconnected. The server does not spawn a separate task for the connection.
-D option launches the server to continuous debug mode. In this mode, the server keeps on listening to the TCP port and accepts several connections. The server spawns new task for each new connection and needs to be stopped manually when you want to finish the debugging.
The debug level is either a number, or a comma-separated list of assignments of the format
ModulePattern=debug_level, for example
"*=7,sshd2=2". Debug level 4 is usually sufficient. For more detailed information, debug level 7 can be used.
Debugging Using USS shell
When debugging the server, a second server daemon can be started to a different TCP port or alternatively the existing server can be stopped and the same port can be used for debugging.
Debugging can be started with the following command (run as the
> /etc/ssh2/init.d/ssh2 start foreground -d 4 -p 1234
In the command,
-d defines the debug level and
-p the TCP port. With this command the debug output is displayed to the screen.
Debug can also be forwarded to a file:
> /etc/ssh2/init.d/sshd2 start foreground -d 4 -p 1234 >/tmp/sshd2_debug.out 2>&1
Debugging for the SFTP server subsystem can be controlled with the
SSH_SFTP_DEBUG_FILE environment variables.
SSH_SFTP_DEBUG defines the debug level for the file transfer server.
SSH_SFTP_DEBUG_FILE defines the output file for the debug messages.
Debugging using a Started Task
-D option can be used on the SSHD2 started task. Output is stored in the defined STDERR file.
//SSHD2 EXEC PGM=BPXBATCH,REGION=0M,TIME=NOLIMIT,
// PARM='PGM /bin/sh /etc/ssh2/init.d/sshd2
// start foreground -D 7'
//STDOUT DD PATH='/tmp/SSHD2-sshd2.out',
//STDERR DD PATH='/tmp/SSHD2-sshd2.err',
//STDIN DD DUMMY