0

I'm trying to make a site to site transfer with the following configuration. I have an old server (server-A), the new server (server-B), and my workstation (wks), on which I'd like to launch the transfer.

SSH key exchange has been done between wks and server-A/B.

Server-A and server-B have no keys exchanged.

I tried the following command from my workstation

scp -r root@server-A:/path/to/source/ root@server-B:/destination/path

but it doesn't work. As far as I understand, server-A tries to connect to server-B, and as there's no key exchange done, it fails.

Any idea how to make the file transfer work for this particular configuration?

  • Download the files to your workstation then upload them to the other server. – Appleoddity Aug 8 '18 at 5:28
  • ssh into server A, start the scp on server A (one command). Avoids copying the files twice. – dirkt Aug 8 '18 at 5:54
  • Thanks but no thanks, the purpose is to avoid connecting on server-A and B, and do it "remotely". – SBO Aug 8 '18 at 7:41
2

Transferring files using a direct connection between server-A and server-B is the preferred method. This is what scp is trying to do. The relevant part of man 1 scp:

-3
Copies between two remote hosts are transferred through the local host. Without this option the data is copied directly between the two remote hosts. Note that this option disables the progress meter.

You're right that without the -3 option "server-A tries to connect to server-B". My tests indicate that even if server-B allows password-based authentication, interacting with tty (while being asked the password) will most likely be the problem. In such case this comment seems useful:

ssh into server A, start the scp on server A (one command). Avoids copying the files twice.

After you explicitly ssh into server-A, scp invoked there should have no problem interacting with tty while asking the password for server-B. Alternatively you can ssh into server-B and invoke scp there.

If it's impossible (key required, password disallowed), use scp -3 on your workstation. Obviously this will use your local machine as a kind of proxy, so the data will flow down and up its network connection(s).

Not all scp implementations support -3 though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.