I have 3 machines:
- Server A (build machine where code will run)
- Server B (Linux)
- Server C (Linux)
My code is running in Server A. I want to ssh to Server B and then copy files to Server C. I want to use password of Server B and Server C and NOT keys.
In my case I am able to write code to copy files from local machine to remote using Paramiko. I looked for many solutions on stackoverflow like below:
import paramiko
from scp import SCPClient
def createSSHClient(server, port, user, password):
client = paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(server, port, user, password)
return client
ssh = createSSHClient(server, port, user, password)
scp = SCPClient(ssh.get_transport())
cp.get(r'/nfs_home/appers/xxxx/test2.txt', r'C:\Users\xxxx\Desktop\MR_Test')
But again files are getting copying from local (where code is run) to remote and not remote to remote.