Archived Forum Post

Index of archived forum posts

Question:

Receiving a Permission denied error when calling sftpRequest.OpenFile()

Oct 16 '12 at 17:13

Hello,

We have implemented the SFTP utility which has been working for some time. However, this morning we received the following error in our logs. Is it evidentobvious from your side that this is simply a permissions issue with the destination?

We're working with a third party and we don't have visibility into their systems and want to know how we should approach them on the issue.

Thanks!

The application errors on the following line:
var handle = sftpRequest.OpenFile(destinationFileHandle, "readWrite", "createTruncate");


Error details below:

System.Exception: ChilkatLog: OpenFile: DllDate: Apr 14 2012 UnlockPrefix: JEROMESSH Username: COLO1-VM-RMJOB:SQLAgentAccount Architecture: Little Endian; 32-bit Language: .NET 4.0 SshVersion: SSH-1.99-OpenSSH_3.9p1 SftpVersion: 3 filename: certona_chicos_certona_browse_20121015.csv access: readWrite createDisposition: createTruncate v3Flags: 0x1b Sent FXP_OPEN StatusResponseFromServer: Request: FXP_OPEN InformationReceivedFromServer: StatusCode: 3 StatusMessage: Permission denied --InformationReceivedFromServer --StatusResponseFromServer SshLog: SFTP> Sending SSH_FXP_OPEN TRAN> CHANNEL_DATA TRAN* NumBytes: 63 TRAN< CHANNEL_DATA SFTP< Received SSH_FXP_STATUS Failed. --OpenFile --ChilkatLog at Resonance.Remarketing.FileDelivery.DeliveryServices.FtpDeliveryService.SendSSL(AbandonmentDataFile file) in C:TFSCertonaScrumDEVResonance.Remarketing.FileDeliveryDeliveryServicesFtpDeliveryService.cs:line 160 at Resonance.Remarketing.FileDelivery.DeliveryServices.FtpDeliveryService.Send(AbandonmentDataFile file) in C:TFSCertonaScrumDEVResonance.Remarketing.FileDeliveryDeliveryServicesFtpDeliveryService.cs:line 40 at Resonance.Remarketing.FileDelivery.Program.Main(String[] args) in C:TFSCertonaScrumDEVResonance.Remarketing.FileDeliveryProgram.cs:line 46


Answer

Yes, it's a permissions problem on the server-side. If you are opening the file for the purpose of reading (not writing or creating), then you can try changing the access and createDisposition args to readOnly and openExisting instead of readWrite and createTruncate. Maybe the permission are such that the server doesn't allow your SSH/SFTP user account to write or create files in the directory.