cURL / Mailing Lists / curl-library / Single Mail


SFTP issues

From: Abel Alonso <>
Date: Fri, 25 Apr 2008 18:10:25 +0200


I'm having problems with SFTP connections. I'm using the lib curl April 25th
snapshot and libssh2 0.18.

The first problem I get is when I try to connect to the server. Instead to
go to the user folder, it list me the server root one. this action is
implemented with the follwing easy interface options setted:

curl_easy_setopt( curl, CURLOPT_SSH_AUTH_TYPES,
                CURLSSH_AUTH_ANY );
curl_easy_setopt(curl, CURLOPT_USERAGENT, "MyAgent" );
        curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorMsg );
        curl_easy_setopt( curl, CURLOPT_PROXY, proxy );
        curl_easy_setopt( curl, CURLOPT_FTP_USE_EPSV, 0 );
        curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0);
        curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, ProgressCallback);
        curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, this );

#ifdef _DEBUG
        curl_easy_setopt(curl, CURLOPT_VERBOSE, TRUE);
        curl_easy_setopt( curl, CURLOPT_DEBUGFUNCTION, curl_debug_callback

        curl_easy_setopt(curl, CURLOPT_URL, remUrl);
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
        curl_easy_setopt(curl, CURLOPT_WRITEDATA, &chunky);

       curl_easy_perform( curl );

The rest of issues are when I try to execute some POSTQUOTE command, because
it always perform commands over the user directory. I meant, I set the
CURLOPT_URL value to, for instance, user_folder/Other_folder, and I try to
execute some POSTQUOTE command (for instance rm) on some file of this
folder, well, as far as I know it should work, but it doesn't. This is
because the command is executed having as working directory the user folder,
so to make it works I must to indicate the Other_folder/ before the name of
the file. In other protocols I use this didn't happen, so I guess that I'm
doing something wrong, but I don't know what it is.

Could you help me to fix these both issues?

Thanks a lot!

Received on 2008-04-25