SFTP Open: The meaning of “No Such File”

When an SSH/SFTP server responds to a file open request with the error message “No Such File”, it means that it could not find the file (i.e. there was no such file).

This is a snippet from the LastErrorText property:

...
    OpenRemoteFile:
      filename: something.dat
      access: readOnly
      createDisposition: openExisting
      v3Flags: 0x1
      Sent FXP_OPEN
      StatusResponse:
        Request: FXP_OPEN
        StatusCode: 2
        StatusMessage: No such file
...

If a relative path is used, then the path is relative to the HOME directory of the SSH/SFTP user account.  In the case above, only a filename is provided, and therefore the SSH/SFTP server is expecting to find “something.dat” in the HOME directory of the SSH/SFTP user account.  If the file is not there, the response will be “No Such File”.

If an absolute path is used (i.e. a path starting with “/”), then it is a request to open that exact absolute path (relative to the filesystem’s root “/” directory).  It is likely that if the path is not under the SSH/SFTP user’s home directory, the server will not have permission to access the file and the error returned will be “No Permission” (or something pertaining to not having permission to access a file or directory..)