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.

roaima
  • 107,089
  • 14
  • 139
  • 261
Swapnil Dhule
  • 431
  • 1
  • 6
  • 13

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
  • 234,489
  • 66
  • 447
  • 667
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)

ImranRazaKhan
  • 171
  • 1
  • 10