I use paramiko module and I can simply put and get files to and from remote host. Is there the way I can copy the file between 2 remote hosts?
I have pem file on my local host so I can establish ssh to both hosts. Is there the way I can do it without (if possible) additional configuration on remote hosts – using SSH key and without passwords?
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
privkey = paramiko.RSAKey.from_private_key_file (path_to_priv_key_file)
ssh.connect(host, username = username, key_filename=path_to_priv_key_file)
I have connection to remote host, but when I try
cmd = "scp –v /usr/local/1.py user1@hos1:/usr/local"
ssh.exec_command(cmd)
I get Permission denied (publickey).
Basically you would like to have a password less connection between two machines.
It is dangerous unless you can assure that no one else has access to the client machine.
Take a look here how to create the password less connection I have described thee years ago in my blog.
It will solve scp issue as well.
http://greg-n-blog.blogspot.com/2009/10/ssh-and-scp-without-being-asked-for.html