login about faq

I am getting the following error when trying to create a remote directory via SSH/SFTP:

ChilkatLog:
  CreateDir:
    DllDate: Dec 12 2012
    UnlockPrefix: xyz
    Username: myUsername
    Architecture: Little Endian; 32-bit
    Language: ActiveX
    VerboseLogging: 0
    SshVersion: SSH-2.0-VShell_3_8_3_292 VShell
    SftpVersion: 3
    path: xyz
    StatusResponseFromServer:
      Request: FXP_MKDIR
      InformationReceivedFromServer:
        StatusCode: 3
        StatusMessage: Permission denied
      --InformationReceivedFromServer
    --StatusResponseFromServer
    Failed.
  --CreateDir
--ChilkatLog

My program simply calls Connect, then AuthenticatePw, then InitializeSftp, and then CreateDir, passing the string "xyz" to the CreateDir method. I would expect that it should create the "xyz" directory in the HOME directory of the SSH/SFTP user account. What is the problem?

asked Mar 05 '13 at 15:49

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

In addition, if I interactively use IPSwitch's tool to login and create a directory, I can do it.

(Mar 05 '13 at 15:53) chilkat ♦♦

First, the error returned by the server is "permission denied", and this should be believed. It means one of the following:

1) Your code is doing everything right -- it connected to the correct server, logged on to the correct account, and passed the correct directory path, but the remote SSH/SFTP user account, or the remote directory permissions, are such that you don't have permission to create a directory. The solution is on the server side -- meaning that the SSH server administrator should verify that the user account has permissions, verify the HOME directory, and verify the directory permissions on the remote filesystem.

2) You are somehow not connecting to the correct server, or not logging in to the correct user account (or at least not using the server and/or user account you intend). Verify in your code through debugging that the server host and username are correct.

3) The HOME directory is something different than what you expected. Perhaps the IPSwitch client tool is setup to automatically switch to some other directory immediately after logging in? Add a call to RealPath to find the exact path of the HOME directory:

string homePath = sftp.RealPath(".","");

4) Maybe the server treats every directory path as an absolute path from the root of the hard drive. If your HOME directory is "/home/john", then pass "/home/john/xyz" instead of "xyz".

5) Maybe the directory "xyz" already exists, and the "permission denied" error is caused by this fact.

link

answered Mar 05 '13 at 16:01

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×200
×7
×6
×3

Asked: Mar 05 '13 at 15:49

Seen: 1,654 times

Last updated: Mar 05 '13 at 16:01

powered by OSQA