How to transfer entire directory from one server to another via SSH

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?

1

1 Answer

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/.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like