SSH

Debugging File Transfer

The return codes and error messages should be sufficient to explain most errors. Check that the code and message are correct by looking at the results:

To diagnose file transfer problems, take a trace. If possible, also take a trace of a similar but successful run and compare the two traces. To get traces that can be compared with a diff command, use a trace format without "%Dx" or "%p" specifiers:

SSH_DEBUG_FMT=" %m/%s:%n:%f %M"

To trace the generic file transfer level, use the debug string 'sftp*=14'.

To trace the z/OS low level, use the debug string '*mvs*=7'.

To trace both, use 'sftp*=14|*mvs*=7'.

To get the trace for the client end, put the debug string on the command line, for example:

$ sftpg3 -D "sftp*=14" user1@www.example.com 

To get the trace for the server end when using sftpg3, use the debug command:

sftp> pwd
sftp> lpwd
sftp> debug 'sftp*=14|*mvs*=7
sftp> sput tmp.txt //TMP.TXT
sftp> debug 1

To get the trace for the server end when using scpg3, create, on the remote machine, the file $HOME/.ssh2/environment, and put in a line like this:

SSH_SFTP_DEBUG=sftp*=14

To make the debug at the server end go into a HFS file at the server, add this line in the $HOME/.ssh2/environment file:

SSH_SFTP_DEBUG_FILE=/tmp/my-debug.txt