# Scp,sftp through a tunnel

### Prerequisites

Copying files to a remote system over scp or sftp requires an SSH server running on the remote side. On almost all Linux systems SSH is installed and active.

Create a tunnel for SSH access to the remote server. The tunnel will end on a random port on your rport server. Remember the port number.

![Get the port number of the tunnel](https://1142160776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekeI9EovpQqbUTQSdM%2Fuploads%2F0bZNwVfhdfTp0bzMWi9D%2Fimage.png?alt=media\&token=f285c362-5dd5-4a76-b39e-d0590a21742e)

### Using scp or rsync

To copy a file to the remote system over the tunnel via scp use

```
scp -P <PORT> <LOCAL-FILE> <USER>@<RPORT-SERVER>:<DESTINATION>
```

For example:

```
scp -P 22708 /etc/hosts hero@rport.example.com:/tmp/
```

Doing the same over rsync

```
rsync -e "ssh -p 22708" /etc/hosts hero@rport.example.com:/tmp/
```

### Using Filezilla

* Open the site manager of Filezilla.
* Create a new site using the "SFTP- SSH File Transfer Protocol.
* Enter the name of the rport server as "Host".
* Enter the port of the tunnel as port for the Filezilla connection

![Use Filezilla for file transfers over a tunnel](https://1142160776-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MekeI9EovpQqbUTQSdM%2Fuploads%2FWXZqC8V2XEbWyeeEdcsT%2Fimage.png?alt=media\&token=83bc40ce-1d65-4182-9042-45f16f28a95e)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kb.openrport.io/getting-started/using-the-remote-access/scp-sftp-through-a-tunnel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
