Skip to content Skip to sidebar Skip to footer

Python - Transfer A File Between Two Remote Servers, Excecuting A Python Script

I am trying to copy a file between two servers from a localServer, say from server-A to server-B. I am using paramiko package in python. So there are three servers namely, localSer

Solution 1:

Question is year old, so probably not relevant anymore, but maybe it will be useful to others. The problem is in your copy.py.

sftp.put('source.txt','/home/serverB/destination.txt' )

where is source.txt located? Either provide full path, or if the file is always located in in the same dir as copy.py you could modify your paramiko_test.py

ssh.exec_command("cd /home/username/; python /home/username/copy.py")

Post a Comment for "Python - Transfer A File Between Two Remote Servers, Excecuting A Python Script"