python paramiko giving error "Permission denied [Errno 13]" on windows server on using sftp

paramiko, python, sftp, windows

Solution

Thanks All! Finally I found the answer. It was because of the format of the filepaths.

On trying `sshObj.get("/remote_file.txt","C:/tmp/local_file.txt")` it succeded without any error.

Download the tool winSCP, it has a good GUI which will help you understand the format of file paths properly.

Also check your base SFTP folder on the remote machine because in my case the error was thrown because `remote_file.txt` was not located at the root sftp folder(which can be configured manually) on the remote box.

Problem

trying to download some files from windows server using sftp in paramiko. get method is: ``` def get(self, remotepath, localpath = None): """Copies a file between the remote host and the local host.""" if not localpath: localpath = os.path.split(remotepath)[1] self._sftp_connect() self._sftp.get(remotepath, localpath) ``` On running the script as `sshObj.get('C:\\my_file.txt', 'D:\\python\\')`, it throws the error : ``` File "C:\Py34\lib\site-packages\paramiko\sftp_client.py", line 806, in _convert_status raise IOError(errno.EACCES, text)`PermissionError: [Errno 13] **Permission denied**` ``` I have given all the permissions to the folder. also shared it with other users. But still the error is there. Any leads if anyone has faced this before will be helpful. Note: I installed freesshd to make my localbox an ssh server.

Original source