login about faq

while sending files using sftp2 by some background process (for ex windows batch file), how to confirm server available or not or files transferred sucessfully? i tried with error level for sucess full commands it shows 6 otherwise 4 ... is it right?

Please clarify

asked Oct 12 '10 at 20:55

Prakash%20Mani's gravatar image

Prakash Mani


the old sftp2 client from Tectia 4.x uses the same exit values as ssh2. In normal operation the return code zero means that the executed operation was successful. Please find information about SFTP2/SSH2 return codes from below:


   On normal execution, ssh2 exits with  the  status  of  the
   command run. On successful runs this is normally 0 (zero).

   If ssh2 encounters an error, you usually see the reason in
   an  error message. However, accommodating for that in e.g.
   batch files is difficult, so some usual  exit  values  for
   ssh2  are documented here.  Note that the command you have
   run may also return the same exit values.   Unfortunately,
   little  can be done to avoid this, as the exit value space
   is so small (8 bits).

   128 + signal number
          This is returned if ssh2 encounters a fatal signal.
          E.g. 143 would be returned for SIGTERM (signal num-
          ber 15).

   64 + disconnect code
          This is returned on disconnect, clean or otherwise.

                 host not allowed to connect      1
                 protocol error                   2
                 key exchange failed              3
                 reserved                         4
                 MAC error                        5
                 compression error                6
                 service not available            7
                 protocol version not supported   8
                 host key not verifiable          9
                 connection lost                 10
                 by application                  11
                 too many connections            12
                 auth cancelled by user          13
                 no more auth methods available  14
                 illegal user name               15

          E.g. 74 would mean 'Connection lost'.

   -1     Returned on a call for ssh_fatal().

   254    Usually means that ssh2 failed to exec(3) something
          (generic catch-all in the libraries for failures to
          fork(2) or exec(3)).

   1      Generic error, usually because invalid command-line
          options or malformed configuration.

   2      Connecting to remote host failed.


Please note that the more current Tectia SFTP client, the SFTPG3 client (in 5.x/6.x series), will have its own return codes and you can find those from here: http://productdocs.ssh.com/support/documentation/online/ssh/winhelp/61/sftpg3.html

Hopefully this helps!



answered Oct 15 '10 at 21:46

Sami%20Marttinen%201's gravatar image

Sami Marttinen 1

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Oct 12 '10 at 20:55

Seen: 4,885 times

Last updated: Apr 02 '11 at 05:22

All user contributed content licensed under the cc-by-sa license.
Powered by OSQA.