I have two servers, access to SSH on both. I want to transfer entire directory from server A to server B. They are both remote servers to me.

Am I right to assume it is possible to log into SSH terminal on my local PC, connect to server A, and do some magical command that will initiate a transfer between the two servers while being able to log out of terminal on my own local machine?

migrated from serverfault.com Jun 15 '13 at 23:28

This question came from our site for system and network administrators.

  • 3
    Please search for rsync and scp - this question has been answered thousands of time on all kind of sites. – Sven Jun 15 '13 at 14:41

On server A:

$ scp -r /path/to/directory someuser@serverB:/path/to/files/.

The above command will copy the files from serverA to serverB using someuser (a user on serverB). The directory (/path/to/directory) will be copied as a directory to the directory on serverB into the directory /path/to/files/.

  • And if you want to log out before the transfer is finished, look into the "screen" command - you can start a screen, start the scp (or rsync) command, and then detach (ctrl+a, ctrl+d) and log out, while everything keeps running remotely inside the screen session. – faffaffaff Jun 19 '13 at 22:24

Your Answer

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