SSH

Debugging Secure File Transfer

The secure file transfer process (sft-server-g3) is debugged together with the Tectia Server, and the same debug level that is set for Tectia Server (ssh-server-g3) is used for both processes by default.

Tectia Server control utility ssh-server-ctl can be used to troubleshoot running service with debug command. There are file transfer related options that can be used to enable debug mode for the user SFTP server processes without the need to set any environment variables.

ssh-server-ctl debug set "4;sftpfile=/tmp/sftp_debug_%U.txt"

This will create user-specific SFTP debug logs on the server-side. There are two SFTP related debug level options sftpfile=<filename> and sftpdebug=<level>. If only sftpdebug is defined, the debug messages are sent to the ssh-servant-g3 server process.

For more information on SFTP debug options, please see the ssh-server-ctl ssh-server-ctl(8) and ssh-server-config(5) man pages.

Alternatively, the environmental variables can be used to redirect the sft-server-g3 debug messages, that are by default sent to the standard error, that goes also to the SFTP client. If you want to forward the sft-server-g3 debug messages into a file and not to the client, you can add the following two environment variables affecting the secure file transfer user into the /etc/environment file on Unix and into the user-specific environment variables on Windows:

  1. SSH_SFTP_DEBUG defines the debug level that controls the messages that the sft-server-g3 process will be showing while executing. This variable can be used when no debug level has been set for the sft-server-g3 process. The value can be for example:

    SSH_SFTP_DEBUG=SftpLibServer=80,SftpLibStageFsFile=80

    If debug level is set for ssh-server-g3 this variable will be ignored.

  2. SSH_SFTP_DEBUG_FILE defines the file where the debug messages from the sft-server-g3 will be printed. This variable can be used when no debug level has been set for the sft-server-g3 process. The value can be for example:

    SSH_SFTP_DEBUG_FILE=/tmp/sft_debug.txt

    If this variable is not defined, the messages will be sent to standard error as normally, and the SFTP client will receive them.

    If debug level is set for ssh-server-g3 this variable will be ignored.