I am trying to copy directories from linux server to windows machine where both of these are AWS EC2 instances using Python but couldn't do that.
I tried scp command which seems not working on AWS instances, also tried using sftp client of paramiko module in python which is alos not working and throwing access error for windows destination location path.
localpath = 'D:/Temp'
remotepath = '/home/temp'
ssh=paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(hostname=HOST,port=PORT,username=USERNAME,key_filename=KEY)
sftp=ssh.open_sftp()
sftp.put(localpath,remotepath)
sftp.close()
ssh.close()
Following is the error:
Error:
Traceback (most recent call last):
File "test.py", line 12, in <module>
sftp.put(localpath,remotepath)
File "C:\Python27\lib\site-packages\paramiko\sft
with open(localpath, "rb") as fl:
IOError: [Errno 13] Permission denied: 'D:\\Temp'