1

I am at server A. I want to copy a file from remote server B to remote server C.

This can be done with below commands,

scp username@B:/path_of_file_on_server_B/file.txt /path_of_file_on_server_A
scp /path_of_file_on_server_A/file.txt username@C:/path_of_file_on_server_C

However I want to understand if there is any other way to directly copy file from remote server B to remote server C.

Chris Davies
  • 116,213
  • 16
  • 160
  • 287

2 Answers2

4

You can use remote paths as both source and target for scp:

scp username@B:/path_of_file_on_server_B/file.txt username@C:/path_of_file_on_server_C
terdon
  • 242,166
0

On centos it works with -3 option

scp -3 root@SERVERA:/imran.txt root@SERVERB:/

The -3 option instructs the scp command to route traffic through the issuing machine (From where we executing this command)