Transferring files between remote servers or local system

The two most popular tools used to transfer files between remote servers or local system are SCP and Rsync. Before continuing with this guide make sure you have SSH access to the remote server. Consider reading the following guide:

You can get the username and remote_host for your server from the Server View page.

Transferring files using SCP

Secure copy protocol (SCP) is a means of securely transferring computer files between a local host and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol. "SCP" commonly refers to both the Secure Copy Protocol and the program itself.

  • If you are using a different SSH key instead of the default .ssh/id_rsa, you will have to specify it using the -i parameter.

  • A common mistake is not using the : at the end of the remote server host.

  • If you are transferring a directory you will have to use the -r parameter after the scp command

  • The scp basic syntax is:

scp <user>@<source_host>:/file/to/send <user>@<dest_host>:/where/to/put

Transferring a File from a Remote Server to the Local System

scp <username>@<remote_host>:/file/to/send /where/to/put

Transferring a File from the Local System to a Remote Server

scp /file/to/send <username>@<remote_host>:/where/to/put

Transferring a File between two Remote Servers

scp <username>@<remote_host1>:/file/to/send <username>@<remote_host2>:/where/to/put

Transferring files using Rsync

Transferring a File from a Remote Server to the Local System

rsync -avzh <username>@<remote_host>:/file/to/send/ /tmp/myrpms/

Transferring a File from the Local System to a Remote Server

rsync -avzh /file/to/send/ <username>@<remote_host>:/where/to/put/

Transferring a File between two Remote Servers

rsync -avzh <username>@<remote_host1>:/file/to/send/ <username>@<remote_host2>:/where/to/put/