Your browser does not allow storing cookies. We recommend enabling them.


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:

  • Was the file transferred OK but the error code wrong?

  • Was the error code 0 but the file corrupted?

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" 

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:


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:





What to read next:

  • Reduce Secure Shell risk. Get to know the NIST 7966.

    The NISTIR 7966 guideline from the Computer Security Division of NIST is a direct call to action for organizations regardless of industry and is a mandate for the US Federal government.
    Download now
  • ISACA Practitioner Guide for SSH

    With contributions from practitioners, specialists and SSH.COM experts, the ISACA “SSH: Practitioner Considerations” guide is vital best practice from the compliance and audit community.
    Download now