0 votes
by (120 points)

I am trying out SFTP Client lib using C#. While calling Upload method after successfully logging into the SFTP Server (SolarWinds SFTP/SCP server), it throws Rebex.Net.SftpException: Permission denied; Permission denied. Please help me why such response would arise? Here's the log:

2013-11-06 13:54:21.713 Opening log file.
2013-11-06 13:54:21.738 Using FileLogWriter version 2.0.4981.0.
2013-11-06 13:54:21.929 INFO Sftp(1)[1] Info: Connecting to using Sftp 3.0.4981.0 (trial version).
2013-11-06 13:54:22.287 INFO Sftp(1)[1] SSH: Negotiation started.
2013-11-06 13:54:26.204 INFO Sftp(1)[1] SSH: Negotiation finished.
2013-11-06 13:54:26.204 INFO Sftp(1)[1] Info: Server: SSH-1.99-WeOnlyDo 2.2.9
2013-11-06 13:54:26.205 INFO Sftp(1)[1] Info: Fingerprint: ef:ad:5d:42:db:d5:58:89:de:96:0e:b7:aa:b7:3d:25
2013-11-06 13:54:26.206 INFO Sftp(1)[1] Info: Cipher info: SSH 2.0, Diffie-Hellman-Group14-SHA1, RSA, aes256-ctr/aes256-ctr, /
2013-11-06 13:54:26.255 INFO Sftp(1)[1] Command: SSH_FXP_INIT (4)
2013-11-06 13:54:26.465 INFO Sftp(1)[1] Response: SSH_FXP_VERSION (3, 0 extensions)
2013-11-06 13:54:26.466 INFO Sftp(1)[1] Info: Using SFTP v3 on a Windows-like platform.
2013-11-06 13:54:26.471 INFO Sftp(1)[1] Batch: Calling Upload(string = 'F:\BFAPPS\*.zip', string = 'C:\Sftp_Root', TraversalMode = 'Recursive', TransferMethod = 'Copy', ActionOnExistingFiles = 'ThrowException').
2013-11-06 13:54:26.626 INFO Sftp(1)[1] Command: SSH_FXP_STAT (1, '/C:Sftp_Root')
2013-11-06 13:54:26.630 INFO Sftp(1)[1] Response: SSH_FXP_STATUS (1, 3, 'Permission denied')
2013-11-06 13:54:26.717 ERROR Sftp(1)[1] Info: Rebex.Net.SftpException: Permission denied; Permission denied.
at Rebex.Net.LFB.EC(FEB A, Type B)
at Rebex.Net.LFB.RB(String A, Boolean B, Boolean C, Boolean D, MFB E, RFB& H, OEB I)
at Rebex.Net.Sftp.JAB(String A, Boolean B, Boolean C, Boolean D, OEB E)

Applies to: Rebex SFTP

1 Answer

0 votes
by (18.0k points)

Are you sure your target path should be in Windows-style (starting with "C:" )? Most of SFTP servers use an unix-like virtual filesystem without drive letters. If your SFTP server has a physical root directory "C:\Sftp_Root", then the virtual path should be "/" and your upload command should be:

sftp.Upload(@"F:\BFAPPS\*.zip", "/")

If your SFTP server really accepts (and needs) a physical path like "C:\Sftp_Root", please connect to that server with another SFTP client software (e.g. Filezilla) and send us a communication log from that software.