Copying a file from one Server to another through SSH

Posted:  May 14th, 2016

 

How to copy a file to from one server to another, using the following procedure:

 

1) Log in to your server with SSH as root.

 

2) Navigate to the directory where there are the files to be transferred, using cd command:

 

    cd /path/to/the/directory/

 

3) Type the following command (make sure you replace the IP address and the file name):

 

    scp file.txt 12.112.12.11:/root/

 

In the example above, 12.112.12.11 is the IP address of the destination server, and /root/ is the destination folder of file.txt.

 

4) You will be prompted to enter the root password of the remote server.

 

To copy a folder and its contents to another server, please use the following procedure:

 

If you need to copy a folder and its contents, you should use the -r (recursive) option with the command like this:

 

    scp -r foldername 12.112.12.11:/root/

 

For more information on how to use the scp command, please consult this link:

 

http://www.cyberciti.biz/faq/transfer-files-from-unix-server/