Subject: Re: sftp error - LIBSSH2_ERROR_SFTP_PROTOCOL


From: Alexander Lamaison <>
Date: Thu, 6 May 2010 12:47:29 +0100

On 6 May 2010 12:36, Daniel Stenberg <> wrote:
> On Wed, 5 May 2010, Phillip Wu wrote:
>> 2) Where can I get a table of the codes returned by
>> libssh2_sftp_last_error  and their meanings?
> The SFTP errors are straight from the SFTP protocol and are present in
> libssh2_sftp.h with the LIBSSH2_FX_ prefix. See line 171 and onwards.

Daniel is quite right. My earlier answer was misleading and referred
to error codes in general rather than the SFTP subset.

One thing I will point out with regards to the SFTP errors is that
they are only theoretically possible. The actual errors you encounter
depend entirely on the SFTP implementation on the server you are
connecting to. For instance, you may get LIBSSH2_FX_PERMISSION_DENIED
instead of LIBSSH2_FX_FILE_ALREADY_EXISTS when creating a file that
already exists (IIRC this is what happens with OpenSSH).

Be flexible when handling the return codes. Potentially, the server
could return almost any LIBSSH2_FX_* code for any particular SFTP

Received on 2010-05-06