Securely copy files over ssh

You can use scp (secure cp(copy)) to copy files from one server (=remote server) to a other server (=remote server).

Coping files from local server to remote server
scp /source/file/ user@ipaddress:/destination/file/

Coping files from one remote server to another remote server
scp user@ipaddressofserverone:/source/file/ user@ipaddressofserver2:/destination/file/

Where

user : Is the user which have the right to access the file and directory, that is supposed to be copied in the case of the from-host, and the user who has the rights to write in the to-host

ipaddressofserverone : Is the name or IP of the host where the source file is

source/file : Is the file(s) that are going to be copied to the destination host, it can be a directory but in that case you need to specify the -r option to copy the contents of the directory

destination/file : Is the name that the copied file is going to take in the to-host, if none is given all copied files are going to keep its names

SCP Options

-p : Preserves the modification and access times, as well as the permissions of the source-file in the destination-file
-q : Do not display the progress bar
-r : Recursive, so it copies the contents of the source-file (directory in this case) recursively
-v : Displays debugging messages