Archived Forum Post

Index of archived forum posts

Question:

Permission denied when getting file

Apr 21 '15 at 11:27

Please find the error itself here:

OpenFile(15ms): DllDate: Oct 2 2014 ChilkatVersion: 9.5.0.44 UnlockPrefix: Username: Architecture: Little Endian; 32-bit Language: Visual C++ 10.0 (32-bit) VerboseLogging: 1 SshVersion: SSH-2.0-Sun_SSH_1.1.6 SftpVersion: 3

sftpOpenFile(15ms):
  remotePath: MO_Unmatched_Trade_Monitor20150409.csv
  access: writeOnly
  createDisposition: createNew
  v3Flags: 0x2a

  sendPacket(15ms):
    sendPacketType: SSH_FXP_OPEN
    sendRequestId: 2
    sendMessage: CHANNEL_DATA

    sendMessage(15ms):
      EncryptionParams:
        algorithm: aes
        keyLength: 256
        paddingScheme: 3
        cipherMode: ecb
        encodingMode: base64
        charset: windows-1252
        secretKey: //There were real values here
        iv: //There were real values here

        inDataNumBytes: 80

        inData: //There were real values here
      --EncryptionParams
    --sendMessage
  --sendPacket

  Sent FXP_OPEN

  readSftpPacket:
    loopIdx: 1

    readChannelData_2:
      readChannelData: chan=0; tmOutMs=0; checkQ=1; onlyExt=0; skipExt=1; idleTmOutMs=0; bOneRaw=0

      genRead_1:
        packetLen: 44
        mType: CHANNEL_DATA
        payload: msgType=94; len=47
      --genRead_1
    --readChannelData_2
  --readSftpPacket

  packetType: SSH_FXP_STATUS

  StatusResponseFromServer:
    Request: FXP_OPEN
    InformationReceivedFromServer:
      StatusCode: 3
      StatusMessage: Permission denied
    --InformationReceivedFromServer
  --StatusResponseFromServer

  retryFilepath: ./MO_Unmatched_Trade_Monitor20150409.csv
  remotePath: ./MO_Unmatched_Trade_Monitor20150409.csv

  access: writeOnly
  createDisposition: createNew
  v3Flags: 0x2a

  sendPacket:
    sendPacketType: SSH_FXP_OPEN
    sendRequestId: 3
    sendMessage: CHANNEL_DATA
    sendMessage:
      EncryptionParams:
        algorithm: aes
        keyLength: 256
        paddingScheme: 3
        cipherMode: ecb
        encodingMode: base64
        charset: windows-1252

        secretKey: XXXX //There were real values here
        iv: XXXX //There were real values here

        inDataNumBytes: 80
        inData: XXXX //There were real values here
      --EncryptionParams
    --sendMessage
  --sendPacket

  Sent FXP_OPEN

  readSftpPacket:
    loopIdx: 1

    readChannelData_2:
      readChannelData: chan=0; tmOutMs=0; checkQ=1; onlyExt=0; skipExt=1; idleTmOutMs=0; bOneRaw=0

      genRead_1:
        packetLen: 28
        mType: CHANNEL_DATA
        payload: msgType=94; len=47
      --genRead_1
    --readChannelData_2
  --readSftpPacket

  packetType: SSH_FXP_STATUS

  StatusResponseFromServer:
    Request: FXP_OPEN

    InformationReceivedFromServer:
      StatusCode: 3
      StatusMessage: Permission denied
    --InformationReceivedFromServer
  --StatusResponseFromServer
--sftpOpenFile

Failed.

--OpenFile --ChilkatLog

Maybe you can advise what can be wrong here.


Answer

The relevant information is this part of the LastErrorText:

  remotePath: MO_Unmatched_Trade_Monitor20150409.csv
  access: writeOnly
  createDisposition: createNew

It says you are trying to create a new file for write-only in the HOME directory of your SSH/SFTP user account. (It is in the HOME directory because no path was provided in the remotePath.) If the MO_Unmatched_Trade_Monitor20150409.csv already exists, then you will get an error. You would want to tell the server to open the file "createTruncate" instead of "createNew". See the online reference documentation for the OpenFile method. Also, it could simply be a problem with directory permissions w.r.t. to your user account on the SFTP server..


Answer

Thank you for your reply. I did try createTruncate after posting this, and still got the same reply. So it might be as you suggest - the account I use has some issues with permission for the home directory?

As for the path on the remote server, didnt have much influence over that.