Remotely copy between two servers from a third server with all ssh key set
I'm writing a deploy script using python, however after I finished it I found there might be not possible for what I thought.
The situation is like this.
I have 3 hosts.
Host1: Ubuntu 12.04
Host2: SUSE Linux Enterprise Server 11 SP1
Host3: Windows Server 2008 R2, with Cygwin 1.7.8 installed, also WinSSHD installed (I know normal ssh login is handled by WinSSHD, however rsync uses cygwin path, don't know what's wrong)
Now I need to run the remote copy command on Host1, to let the file transfer between Host2 and Host3. I set all the ssh keys already, there's no problem to use scp after ssh login to any of the host.
However this will fail.
Host1:~$ ssh Host2 scp Host3:/myfile_on_Host3 /target_Host2_path
This command returns nothing, the scp should list the file copying but this just return nothing, and the file is not copied.
And this will fail too,
Host1:~$ scp Host3:/myfile_on_Host3 Host2:/target_Host2_path
The same , this returns nothing, not even a line.
However the following will work,
Host1:~$ ssh Host2
Host2:~$ scp Host3:/myfile_on_Host3 /target_Host2_path
So I'm totally confused here, why on a third host, I cannot do remote copy between two other servers ?
Update:
I made the file copying finally work using rsync rather than scp, but I am still totally confused.
So this will copy the file.
Host1:~$ ssh -A Host2 'rsync /myfile_on_Host2 Host3:/cygdrive/d/targetHost3Path/'
And the following will work too using scp.
Host1:~$ ssh -A Host2 'scp /myfile_on_Host2 Host3:D:targetHost3Path'
链接地址: http://www.djcxy.com/p/92206.html
上一篇: 使用pip无法安装私人github资源库