Advertisement
Guest User

Untitled

a guest
Jul 18th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import paramiko
  2.  
  3. remote_source = '<somedir>/file.py'
  4. remote_destination = '<anotherdir>/file.py'
  5. local_path = './file.py'
  6. ssh = paramiko.SSHClient()
  7. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  8. ssh.connect('<ip>',username='<username>',password='<password>')
  9. ftp = ssh.open_sftp()
  10. ftp.get(remote_source,local_path) #Download.This works
  11. ftp.put(remote_destination,local_path) #Copy to server.
  12. ftp.close()
  13. ssh.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement