Question:
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?
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.