I am trying to do SFTP between two servers using a Python script. At first, my attempt was to download the files to my local machine, it is failing with permission error, not sure why it is restricting to copy files to my local folder.
Any ideas will be appreciated. Below is the code snippet (Only half done)
import paramiko
host= <defined here>
user = <defined here>
pswd = <defined here>
ssh = paramiko.SSHClient()
# automatically add keys without requiring human intervention
ssh.set_missing_host_key_policy( paramiko.AutoAddPolicy() )
ssh.connect(host, username=user, password=pswd)
ftp = ssh.open_sftp()
ftp.get(source_path,destination_path)
ftp.close()