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

Archive Index This month's Index

Subject: [libssh2] #287: LIBSSH2_FX_PERMISSION_DENIED on reading file from other user

[libssh2] #287: LIBSSH2_FX_PERMISSION_DENIED on reading file from other user

From: libssh2 Trac <trac_at_libssh2.stuge.se>
Date: Fri, 11 Apr 2014 19:21:13 -0000

#287: LIBSSH2_FX_PERMISSION_DENIED on reading file from other user
---------------------------------------+--------------------
 Reporter: pschultz | Owner:
     Type: defect | Status: new
 Priority: normal | Milestone: 1.4.3
Component: SFTP | Version: 1.4.2
 Keywords: sftp open file permission | Blocked By:
   Blocks: |
---------------------------------------+--------------------
 Hi,

 I used the libssh2 examples "sftp.c" and "sftpdir.c", lightly modified to
 get more information on the errors.

 I have to get files from several subdirectories on a SFTP Server.
 Some of these subdirectories ar written by other users, one is written by
 the user which I use as login with user and password.
 All users are in the same group.

 Getting files which are created by "my" user works fine.

 But when I try to get the other files then libssh2_sftp_open fails,
 libssh2_session_last_error returns -31 (= LIBSSH2_ERROR_SFTP_PROTOCOL) and
 libssh2_sftp_last_error returns 3 (= LIBSSH2_FX_PERMISSION_DENIED).

 I have no problems reading the directories (libssh2_sftp_opendir /
 libssh2_sftp_readdir_ex).

 Examples:
 My directory on the server:
 -rw-rw-r-- 1 My_User Group1 7923 Apr 9 13:49 file1 (ok)

 Another directory:
 -rw-r--r-- 1 Other_User Group1 1229 Apr 9 00:59 file2 (fails)

 The system I work on is SUSE Linux Enterprise Server 11 (i586).
 The version of libssh2 is 1.4.3.

 /usr/bin/sftp has no problems, I can get all files; same on windows with
 WinSCP.
 The problem must be on my side.

 What could I make better? Are there more steps to do than coded in the
 examples?

 Thanks

 Peter

-- 
Ticket URL: <https://trac.libssh2.org/ticket/287>
libssh2 <https://trac.libssh2.org/>
C library for writing portable SSH2 clients
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2014-04-11

the libssh2 team