copying files from remote machine to another remote machine
gkambalu opened this issue · comments
if i want to copy a file from a remote machine to another remote machine how can we achieve with SCP module, please help.
If you want the transfer to happen between those machines, you can simply run the scp command on the first machine. Something like:
from paramiko import SSHClient
ssh = SSHClient()
ssh.load_system_host_keys()
ssh.connect('source.example.com')
ssh.exec_command('scp file.txt destination.example.com:file.txt')
If you want the transfer to go through your local machine, it will be a little more involved, but can probably be done.
The scp module talks the scp protocol, but you don't need to do that if the communication is directly between remote servers. So you don't need anything more than plain paramiko, as shown above.
Let me know if I am misunderstanding your objective.
Closing this, seems similar to #181