Using SCP command line for secure file transfer

SCP (Secure Copy Protocol) is a widely used means of sending files from one system to another over a network. SCP uses the SSH server on the target, so there is no need to set up a remote.it Service for SCP if you already have a remote.it Service for SSH installed.

We'll assume that you've already used remote.it to configure a SSH Service on your target Device. For more information on setting up a Service with remote.it, see our guide.

The SCP command line

Supposing that you wish to transfer a file "bigfile.bin" in the current folder on your client system to the /home/pi/Downloads folder on the target system, run the following command line. You will need to place the username in the command line as shown.

$ scp -P <port> <path to local file> <target user name>@<hostname>:<full path to target folder>mes out as:
 

Using a Peer-to-Peer (P2P) Connection

If you are using one of the methods to set up a peer to peer connection, the hostname will be localhost (127.0.0.1) and the port will be as shown by the P2P connection method you are using.

For example, using the Desktop app for Windows:

SCP_command_line_1.png


You can now use this information on the scp command line as shown.

 
C:\Users\You>scp -P 33000 bigfile.bin pi@localhost:/home/pi/Downloads
The authenticity of host '[localhost]:33000 ([127.0.0.1]:33000)' can't be established.
ECDSA key fingerprint is SHA256:89b83FWn9SdVi9Mp2jwN8lDWu0STbWxfyLrCUgQsj9E.
Are you sure you want to continue connecting (yes/no)?
Warning: Permanently added '[localhost]:33000' (ECDSA) to the list of known hosts.
pi@localhost's password:
bigfile.bin 100% 204KB 2.5MB/s 00:00
 
C:\Users\You>
 

Using a proxy connection

A proxy connection will be returned when you make a connection through the remote.it website, or use the /device/connect API endpoint. You will get a hostname and port that will look something like this:

SCP_command_line_2.png
$ scp -P 34836 bigfile.bin pi@proxy13.remot3.it:/home/pi/Downloads
The authenticity of host '[proxy13.remot3.it]:34836 ([69.64.70.155]:34836)' can't be established.
ECDSA key fingerprint is SHA256:89b83FWn9SdVi9Mp2jwN8lDWu0STbWxfyLrCUgQsj9E.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[proxy13.remot3.it]:34836,[69.64.70.155]:34836' (ECDSA) to the list of known hosts.
bigfile.bin 100% 498KB 498.5KB/s 00:00
$
Was this article helpful?
0 out of 0 found this helpful