www.libssh2.org | Daily snapshots | Mailing list archive | Docs | Examples | github

Archive Index This month's Index

Subject: Running example sftp_write.c results in error 2, LIBSSH2_FX_NO_SUCH_FILE

Running example sftp_write.c results in error 2, LIBSSH2_FX_NO_SUCH_FILE

From: Michael Loutris <mloutris_at_comcast.net>
Date: Fri, 16 Oct 2020 13:01:14 -0500 (CDT)

I am trying to securely transfer a file between two windows 10 devices, and modified the example sftp_write.c, building in Visual Studio 2017 for x86 and debug.
Running OpenSSH commands from a Windows command prompt are successful in transferring files.

All the libssh2 calls return success until libssh2_sftp_open(), where the sftp handle is returned NULL.
Calling libssh2_sftp_last_error() returns error 2, LIBSSH2_FX_NO_SUCH_FILE.
The flags and mode were left with the defaults:

sftp_handle = libssh2_sftp_open(sftp_session, sftppath,
LIBSSH2_FXF_WRITE | LIBSSH2_FXF_CREAT | LIBSSH2_FXF_TRUNC,
LIBSSH2_SFTP_S_IRUSR | LIBSSH2_SFTP_S_IWUSR |
LIBSSH2_SFTP_S_IRGRP | LIBSSH2_SFTP_S_IROTH);

As OpenSSH commands in a Windows command prompt succeeded in writing to the server, what settings might I be missing in libssh2?

Thank you

_______________________________________________
libssh2-devel https://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2020-10-16

the libssh2 team