Suppose you want to backup or transfer files from one remote server to another you can do it simply by using scp. Let me brief you about SCP.
SCP stands for secure copy (remote file copy program).
scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1). scp will ask for passwords or passphrases if they are needed for authentication.COPY CODE SNIPPET
File names may contain a user and host specification to indicate that the file is to be copied to/from that host. Local file names can be made explicit using absolute or relative pathnames to avoid scp treating file names containing ‘:’ as host specifiers. Copies between two remote hosts are also permitted.
Enough of theory stuff, let’s see the example:
Suppose you want to transfer files/folder from 188.8.131.529 to 184.108.40.2060. Therefore first login to the server 220.127.116.110 and run the following command as follows:-
scp -r firstname.lastname@example.org:/var/www/html.zip /var/www/html/
-r = Recursively copy entire directories. Note that scp follows sym‐bolic links encountered in the tree traversal.
root = User of that machine.
18.104.22.1689 = Ip of the server where the data exists.
/var/www/html.zip = File that resides on 22.214.171.1249 server.(from where u will transfer)
/var/www/html = Directory of 126.96.36.1990 server where the files will be copied.
For the server which doesn’t have the default port 22 run the following command:
scp -r -P1234 email@example.com:/var/www/html.zip /var/www/html/