How to move files from a remote linux server to another remote linux server:

Transfer files using rsync:

Make sure that the rsync is installed at both ends. Ideally it would be similar or same version of the software:

On Centos 8 do:

yum update && yum install rsync -y

on Debian and Ubuntu systems:

apt-get update && apt-get install rsync -y

There are two ways to operate rsync, you can either push from server A to server B or pull the data from the Server A to the server B. If one machine is faster than the other, this make some noticable diffrence in transfer speed.

To “push” the data from the server you are logged into to the other server:

rsync -avh /var/www/vhosts/ [email protected]:/home/kevin/migration_data/

To "pull" the data off the other server to the one you are logged into:

rsync -avh [email protected]:/home/kevin/migration_data/ /var/www/vhosts/migrated/

In order to be able to rsync files between servers it is required for both machines to have rsync installed. If this is not possible there are other options...

Transfer files using scp:

Scp is provided as a part of openssh suite, it should be preinstalled and ready to be used on the server. This can be verified with “scp” command which prints usage instructions similar to this:

scp usage: scp [-346BCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file] [-J destination] [-l limit] [-o ssh_option] [-P port][-S program] source ... target

That might seem a little daunting but a basic SCP transferring command would be:

scp /home/kevin/migration_data/ [email protected]:/var/www/vhosts/migrated/

The above command should transfer the contents of 'migration_data' on the server you are logged into to the folder 'migrated' on the remote machine.