Remote copying

Transferring files between/from/to remote servers can be done in the following way:

sudo scp -rpC -c blowfish source/. user@server:/folder

where:

  • r - recursive copying (for directories),

  • p - saving the time of file creation,

  • С - compressing files (not relevant for transferring compressed files),

  • с - the fastest protocol for encryption.

In case of having any special needs when copying files use the reference for using scp command tool.

man scp

You can also start remote copying from the third server between two others.

For copying you will require the password of a remote user descending on the authorization scheme and rights of this user for writing to the destination path

If you perform copying from root account, then you should check after transferring files that the target user (including the root) has the access to the folders and the rights for writing.

For example, by running a command

ls -l /folder/subfolder

If needed - change the owner by command

sudo chmod -R user:user /folder/subfolder

Or with the help of rsync:

rsync -avh /path/to/files user@server:/new_path