in reply to Re: Copy file from one sereve to another server directly.
in thread Copy file from one sereve to another server directly.

I'm pretty sure that in this case the data will still go via your machine.

Direct server-to-server copying will probably be much faster. If the servers are within the same data centre, you might achieve speeds of up to several hundred MB per second. Even if they're not, most servers have pretty meaty connections, so you might achieve 50 to 200 MB per second.

The basic trick is to set up passwordless authentication from server 1 to server 2, and passwordless authentication from your client machine to server 1. Then it's just a matter of:

ssh 'user1@server1' 'scp' '/path/to/source' 'user@server2:/path/to/des +t'

Note that the above should still work with password authentication, but you'll be prompted to enter server1's password, then server 2's password.

Replies are listed 'Best First'.
Re^3: Copy file from one sereve to another server directly.
by blindluke (Hermit) on Nov 10, 2014 at 16:52 UTC
    I'm pretty sure that in this case the data will still go via your machine.

    I was assuming that OP wants to run the SCP script on one of the servers, and wrote my examples based on this assumption. Thank you for your reply, and making the critical advice about setting up the passwordless authentication - this should always be step 1.

    Still, you are making another assumption - it's possible that the task OP is trying to solve is caused by the fact that both servers don't have network access to each other. A good example (of a very bad practice) would be copying production data to a test environment, when the security rules prohibit direct network access between production and development. In such cases, traffic usually goes through the workstation of some unfortunate sysadmin. Not that I've ever seen it happen. It's so good that security policies are never violated in IT. ;)

    - Luke