> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://mammoth.io/docs/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# Import files from an SFTP server into Mammoth

> Connect Mammoth to an SFTP server with a password, a Mammoth-generated SSH key or your own private key, import a file, and collect new files as they arrive.

The SFTP connector imports a file from any SFTP-compatible file server into Mammoth as a dataset. You sign in with a username and password, an SSH key Mammoth generates, or your own private key. Open it from **Data Library** > **New dataset** > **Connectors** and search for **SFTP**. Project Admins create the connection; Project Editors can start datasets from a connection the project already has. Which connectors you can add depends on your plan.

## What you can bring in from SFTP

Files of these types: `.txt`, `.csv`, `.tsv`, `.psv`, `.xls`, `.xlsx`, `.xlsm`, `.xml`, `.json`, `.jsonl`, `.ndjson`, `.zip`, `.bz2`, `.gz`, `.tar`, `.7z`.

An Excel workbook opens to its sheets; tick columns from the sheet you want.

## Before you connect SFTP

You need:

- An SFTP server reachable from the internet.
- A user account with read access to the files you want to import.
- The server's hostname or IP address and port (default `22`).
- Mammoth's IP address added to your server's firewall allowlist. The connection form shows it. See [Allow Mammoth through your firewall](https://mammoth.io/docs/learn/get-data-in/network-requirements/).
- One sign-in method:

| Method | What you need |
| --- | --- |
| Username and password | Your SFTP user's password |
| SSH key generated by Mammoth | Access to add a public key to the server |
| Your own private key | Your existing SSH private key in PEM format |

## Connect an SFTP server to Mammoth

These steps follow the shared flow in [Connect a database or app](https://mammoth.io/docs/learn/get-data-in/connect-a-source/).

1. Go to the **Data Library** and click **New dataset**.
2. Choose **Connectors**.
3. Search for **SFTP** and click its tile. The connector workspace opens with the **Chat** showing.
4. The agent asks how you sign in to the server: **Username and password** (recommended), **SSH key generated by Mammoth** or **Your own private key**. Pick one, and it shows a connection card for that method.

![The agent asks which SFTP sign-in method to use: Username and password, SSH key generated by Mammoth, or Your own private key](https://mammoth.io/docs/images/20261102_sftp-sign-in-method.webp)

The bottom of the form shows: "Mammoth connects from IP [address]. Add it to your server's allowlist if needed." Allow that IP address through your firewall.

### Sign in to SFTP with a username and password

Choose **Username and password** for password sign-in. In the connection form under **Data → Connections**, the same option is **Username & Password** under **Authentication Method**.

![Connect SFTP card in the connector workspace chat with Username, Domain, Port, Password and Name, and Test and connect](https://mammoth.io/docs/images/20261102_sftp-connect-card.webp)

| Field | What to enter | Example |
| --- | --- | --- |
| **Username** | SFTP user with read access | `mammoth_user` |
| **Domain** | Hostname or IP address of your SFTP server | `sftp.example.com` |
| **Port** | SFTP port, usually 22 | `22` |
| **Password** | Password for the SFTP user (optional on the card) | |
| **Name** | Optional label for this connection | `SFTP Production` |

Fill in the fields and click **Test and connect**.

### Sign in to SFTP with an SSH key Mammoth generates

Choose **SSH key generated by Mammoth** (**SSH Key** in the connection form). Mammoth creates a unique public key for you to add to your server, so you have no private key to manage.



| Field | What to enter |
| --- | --- |
| **Host** | Hostname or IP address of your SFTP server |
| **Port** | SFTP port (default `22`) |
| **Username** | SFTP user with read access |
| **Display Name** | Optional label for this connection |

1. Fill in the fields and click **Generate SSH Key**. Mammoth shows the public key.
2. Click **Copy SSH Key** to copy it, or **Download key** to save it as a `.pub` file.
3. Add the key to the server's `~/.ssh/authorized_keys` file, on the line for your SFTP user.
4. Return to Mammoth and continue connecting.

### Sign in to SFTP with your own private key

Choose **Your own private key** (**Private Key** in the connection form) if you already have an SSH private key for Mammoth to use.

![SFTP New Connection form with Private Key selected, showing Host, Port, Username, Display Name, and PEM key text area](https://mammoth.io/docs/images/20260826_102123_Screenshot2026-05-221825101.webp)



| Field | What to enter |
| --- | --- |
| **Host** | Hostname or IP address of your SFTP server |
| **Port** | SFTP port (default `22`) |
| **Username** | SFTP user with read access |
| **Private Key (PEM format)** | Your SSH private key in PEM format (`-----BEGIN RSA PRIVATE KEY-----` ... `-----END RSA PRIVATE KEY-----`) |
| **Passphrase** | Optional passphrase, if your key is encrypted |
| **Display Name** | Optional label for this connection |

1. Paste your private key in the **Private Key (PEM format)** box, or click **Upload key file** to select a `.pem` or `.key` file.
2. If your key is passphrase-protected, enter the passphrase.
3. Click **Connect** to save the connection.

Never share your private key or commit it to version control. If you think a key is compromised, remove it from your server's authorized keys at once.

## Open an SFTP file and pick columns

Once connected, the workspace lists the folders and files on the server.

1. In **Tables**, browse the folders and click a file to see its rows. A spreadsheet opens to its tabs.
2. Tick the columns you want. They gather in **Your table**.
3. Click **Preview 100 rows** to check the result.

If a file can't open in the panel yet, ask the agent in the **Chat** to import it.

## Save an SFTP file as a dataset

1. Click **Save as dataset**.
2. Enter a **Dataset name** and choose a folder under **Save in**.
3. Click **Save**. When the dataset is ready, click **Open dataset**.

## Bring in new SFTP files as they arrive

Mammoth saves a file from this connector once and shows **Saved once. Scheduled refresh for files is coming.** A [Dataset Refresh](https://mammoth.io/docs/learn/automate/refresh-a-dataset/) automation can't re-read it. To bring in new files:

1. Set up a **File Collection** automation that collects new files into a folder. It can use a file name pattern. See [What you can automate](https://mammoth.io/docs/learn/automate/).
2. Set up a [Data Consolidation](https://mammoth.io/docs/learn/automate/consolidate/) automation that adds that folder's files to a dataset.

### Pull the next date-stamped file (older datasets)

Datasets created from the older SFTP connector dialog may use a **Future pulls mode**:

| Option | What it does |
| --- | --- |
| **Pull same file** | Re-reads the selected file |
| **Pull next file based on name pattern** | Looks for the next file whose name matches a date pattern |

For `sftp_Tue-01-November-2022_daily.csv`, the pattern is `sftp_<dy>-<dd>-<mon>-<yyyy>_daily.csv`. Put a date format inside `<>`. The supported formats are `dd`, `mm`, `yyyy`, `yy`, `month`, `mon`, `day`, `dy`, `hh`, `mi` and `ss`.

![SFTP New Dataset dialog with Exact Sheet name, Future pulls mode set to name pattern, Folder to pull from, and File pattern](https://mammoth.io/docs/images/20260826_102259_Screenshot2026-05-221846531.webp)



For new setups, use a File Collection automation with a file name pattern.

## SFTP limits

- An uploaded private key file can be at most 16 KB, the maximum size for an SSH private key.

## Troubleshoot SFTP connections

| Symptom | Likely cause | Fix |
| --- | --- | --- |
| Connection fails | The port is closed to Mammoth | Open port 22 (or your custom port) inbound from Mammoth's IP address, shown on the connection form |
| Connection fails | A detail is wrong | Check the host, port and username, and for password sign-in, the password |
| Connection fails with a Mammoth key | The public key isn't installed | Check the key is in `~/.ssh/authorized_keys` under the SFTP user's home directory |
| Connection fails with your own key | The key or passphrase is wrong | Check the key is valid PEM, the passphrase is right, and the matching public key is in `~/.ssh/authorized_keys` |
| Permission denied on a file | The user can't read the file or list its folder | Check permissions with `ls -la` on the server and adjust with `chmod` |
| "Invalid private key format. Please provide a valid PEM-encoded key." | Mammoth couldn't read the key | Use a PEM key that begins with a `-----BEGIN ... PRIVATE KEY-----` line, and paste the whole key, including the `-----BEGIN` and `-----END` lines |
| "File exceeds the maximum allowed size for an SSH private key." | The uploaded key file is over 16 KB | Upload a key file of 16 KB or less |

## Related

- [Connect a database or app](https://mammoth.io/docs/learn/get-data-in/connect-a-source/): the shared connector workspace steps.
- [Allow Mammoth through your firewall](https://mammoth.io/docs/learn/get-data-in/network-requirements/): the IP address to allow.
- [What you can automate](https://mammoth.io/docs/learn/automate/): set up a File Collection automation.
- [Combine incoming data](https://mammoth.io/docs/learn/automate/consolidate/): add collected files to one dataset.
- [Manage saved connections](https://mammoth.io/docs/learn/get-data-in/connections/): reuse or remove this connection.

---
Source: https://mammoth.io/docs/learn/get-data-in/connectors/sftp.md · Updated: 2026-11-08
