# Remote SFTP/FTPS Connections
Source: https://www.stedi.com/docs/edi-platform/configure/trading-partners/connections/remote-ftp

***

title: Remote SFTP/FTPS Connections
sidebarTitle: Remote SFTP/FTPS
------------------------------

Stedi connects to an external SFTP, FTP, FTPS server to exchange files with your trading partner. This could either be a server that your trading partner hosts, or a server that you host outside of Stedi on existing infrastructure. This is the most common connection type to use, since most large trading partners will require you to connect to their server instead of using yours.

Your trading partner will provide you with the connection information required to set up the connection. This typically includes the server address, port, username, and password or private key.

## Create Remote SFTP/FTPS connections

To create a Remote SFTP/FTPS connection:

1. Select **Remote SFTP/FTPS** as the **Connection Type**.

2. Stedi generates an internal **Connection name**. This is never visible to your trading partner and is used for unique identification with your Stedi account only. You can specify a custom name if desired. You cannot edit the name after the connection has been created.

3. Leave **ISA validation options** as **Default** unless you're very sure you need a different setting for your use case.

4. Enter the **Host** (the remote server address) and specify the **Port**.

5. Enter authentication credentials. Enter a **Username**, and either a **Password** or a **private key** from your local machine.

6. Specify the **Root directory** to use in the remote server.

7. (Optional) Use the **Advanced** menu if you need to specify the number of **Retries**, the **Connection timeout**, the **Socket timeout**, and **SFTP algorithms** to use.
   > **Note:** We recommend using the default settings for the majority of use cases. Contact [support](https://www.stedi.com/contact) if you are unsure what settings to use and we'd be happy to help you figure out the right settings.

8. Configure **Inbound settings**.
   * Set the remote directory where Stedi should retrieve inbound EDI files from your partner. You can use the suggested default if your partner has not provided a specific directory. Stedi only looks for files in this specific directory, it does not search for files within sub-directories.

   * Use the toggles to set:
     * How often to poll the remote server
     * Whether to retrieve only new files created since the last fetch
     * Whether to delete files after retrieval.

9. (Optional) Set a **Filter pattern** (regex expression) that Stedi will use to retrieve and process files. Stedi only processes files that match the regex criteria.

10. (Optional) Choose a **File encoding** format. We recommend leaving this as UTF-8 unless you know your partner will be sending files with a different encoding type.

11. Set the the remote directory in **Outbound settings** where Stedi should put generated EDI files for your partner to retrieve. You can use the suggested default if your partner has not provided a specific directory.

12. Click **Create connection** to save the connection.

You can now associate this connection with one or more [transaction settings](/edi-platform/configure/trading-partners/transaction-settings) and use it to exchange files with your trading partner.

## Shared connections

Stedi supports shared remote SFTP/FTPS connections, which allow you to use the same remote server across multiple partnerships. How you configure shared connections depends on your use case.

### Different directory per partner

If each trading partner adds files to a distinct directory on the server, configure the remote SFTP/FTPS connections on each partnership to poll the appropriate directory.

### Single directory for all partners

If all of your trading partners use the same root directory on the remote server, we recommend the following configuration:

1. Create remote SFTP/FTPS connections in each partnership with automatic polling disabled.
2. Create a separate partnership between your local profile and a new partner profile called `REMOTESFTP` or `REMOTEFTPS`.
3. Add a remote SFTP/FTPS connection to the new partnership and configure it to poll the shared remote server. You do not need to configure any other settings within the partnership.

This configuration allows you to easily identify which partnership's connection is polling, making debugging easier.

When Stedi polls the remote server, it automatically retrieves and processes all files that match the [filter pattern](#filter-pattern-for-inbound-files) (if set). During processing, Stedi first associates a file with the correct partnership and then processes the file according to that partnership's transaction settings. This process allows Stedi to process all files on the remote server, even if they are not associated with the partnership connection doing the polling.

## Test the connection

We recommend testing your connection immediately after creation to ensure you can connect to the remote server. To test the connection:

1. Go to the Partnership and click the **ellipses (...)** next to the SFTP/FTPS connection.
2. Select **Test**.
3. Stedi will attempt to connect to the remote SFTP/FTPS server using the credentials provided in your connection and will show a success or error message accordingly.

## Fetch files manually

You can disable automatic polling and retrieve files manually when needed. For example, you may want to retrieve files manually when testing or troubleshooting the connection.

To manually fetch files:

1. Go to the Partnership and click the **ellipses (...)** next to the connection.
2. Select **Fetch now**.

## Filter pattern for inbound files

You can specify a **Filter pattern** (regex expression) for Stedi to use when retrieving inbound files from the Remote SFTP/FTPS connection. When polling the remote server, Stedi only processes files that match the filter pattern.

For example, your trading partner may place files for multiple different entities on the remote server, with different prefixes for each entity. In this case, you could write a regex expression that matches only files with a given prefix.

To validate that the expression matches your expectations, you can **Fetch files manually** or wait until the next automatic polling attempt.

### Use cases

When you configure a remote FTP connection, you can define a polling interval. If there are files on the remote server under the `inbound` directory that you do **NOT** want to bring over to Stedi when polling, you can define a filter pattern to limit the files that Stedi processes. This is useful when you want to store other file types for different purposes in the folder you have selected to poll. For example, you might store CSV files, images, PDFs, etc.

In rare instances, your trading partner might **require** you to configure the inbound subdirectory to be the same as the outbound subdirectory. In this case, it is important that you configure a filter pattern to prevent Stedi from ingesting and processing the outbound files you send to your trading partner. Your filter pattern should identify the naming structure you expect to receive from the trading partner, and you need to make sure that this structure is sufficiently different from the naming structure you use for sending outbound files.

### Example

The following expression matches a filename like `INTERCHANGE-GROUP-20231115154001-681896da.edi`, and would prevent Stedi from processing files with names like `INTERCHANGE-681896da.edi` or `681896da.x12`.

`^(?<ISA>\w+)-(?<GS>\w+)-(?<timestamp>\d+)-(?<unique>\w+).edi$`

## Status and logs

Each Remote SFTP/FTPS connection's status and logs can be found on its overview page. To view the overview page, go to the partnership and click the connection's name.

An **Available** connection status indicates that Stedi is able to connect to the remote server.

The **Logs** detail each connection and polling attempt.

## Static IPs

Enabling a static IP address ensures that your Remote SFTP/FTPS connections always use the same source IP address when communicating with a remote server. This may be required if one or more of your trading partners need to add your IP address to an allowlist to enable access.

You can enable a static IP address from the [EDI Settings](https://portal.stedi.com/app/core/settings) page.