Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- remote_source = '<somedir>/file.py'
- remote_destination = '<anotherdir>/file.py'
- local_path = './file.py'
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect('<ip>',username='<username>',password='<password>')
- ftp = ssh.open_sftp()
- ftp.get(remote_source,local_path) #Download.This works
- ftp.put(remote_destination,local_path) #Copy to server.
- ftp.close()
- ssh.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement