Published

Epicor SFTP Integration: How to Set Up a Secure SFTP Connection

Epicor SFTP integration done right: dedicated users, ed25519 keys, chroot folders, atomic file handoff, Epicor-side options, scheduling and troubleshooting.

Written by
Ali ÖzdurmuşFounder, Veni AI
Reading time
9 min read
Rows of black server cabinets in a quiet data hall with a monitor on a wheeled cart

Most Epicor installations exchange files with the outside world: suppliers send invoices, a bank wants a payment file, a customer expects an EDI document, a price list arrives as CSV every Monday. SFTP is still the most common way to move those files. A good Epicor SFTP integration is not hard, but the details decide whether it runs unattended for years or breaks quietly every few weeks.

This guide covers the connection itself: what typically runs over SFTP, how files get in and out of Epicor, how to build a secure SFTP server, and how to operate it.

What Typically Runs Over SFTP With Epicor

DirectionTypical files
Into EpicorSupplier invoices and delivery notes, price lists, customer purchase orders (EDI or CSV), inventory counts, master data loads
Out of EpicorPurchase orders to suppliers, shipping notices, bank payment files, BAQ or report exports for a warehouse, BI or accounting system

Treat each flow as a separate integration with its own SFTP user, folder and owner. Mixing them in one shared account is the most common design mistake.

How Files Get Into and Out of Epicor

Epicor does not behave the same on every deployment, so check what your version and hosting model offer before you design anything. The list below is the usual toolbox. Confirm availability for your release in the Epicor documentation or with Epicor support.

ToolRoleNotes
Data Management Tool (DMT)Bulk import of CSV or Excel into Epicor business objectsValidation rules and BPMs fire per row. Often run from a script or scheduled job on-premises. Options on Kinetic cloud are more limited, so confirm with Epicor
REST API (v1 and v2)Read and write data from an external programv2 uses API keys. Kinetic and recent Epicor ERP releases only; check your version
BAQs and BAQ reportsQuery data and export it to a fileCan be scheduled through the System Agent
Epicor FunctionsServer-side custom logic callable from RESTNewer Kinetic releases
Automation StudioLow-code workflows that can move files and call EpicorNewer Kinetic releases, cloud and on-premises. Check which file actions your version includes
Epicor EDI productsManaged EDI with partner protocols, including SFTPSeparate product with its own setup

Two practical patterns cover most cases:

  1. Epicor exports, SFTP delivers. A scheduled BAQ export or report writes a file; a small job copies it to the SFTP outbound folder.
  2. SFTP receives, Epicor imports. An import job (DMT, an Automation Studio flow or a small script calling the REST API) picks files from inbound, loads them and moves them to processed or error.

On Kinetic cloud you usually have no access to the host operating system, so the transfer step runs either inside an Epicor feature you are licensed for or on a small integration server you control that talks to Epicor over its APIs. On-premises you can also run scheduled scripts next to the Epicor server.

Build the SFTP Server Properly

1. One user per integration

Create a dedicated account for every partner and flow, for example sftp_acme_invoices. Give it no shell and access to its own folder only. When a partner is offboarded, you disable one account and nothing else.

2. SSH keys, not passwords

Use ed25519 keys and turn passwords off.

bash
ssh-keygen -t ed25519 -a 100 -f epicor_invoices -C "epicor-invoices-2026-11"

The partner or integration job keeps the private key. You install the public key in the user's authorized_keys. Protect the private key with file permissions 600, and with a passphrase where an interactive person uses it.

3. Pin the host key

Clients must verify the server, otherwise a man-in-the-middle can read your files. Send partners the server's fingerprint through a separate channel, and have them store it in known_hosts.

bash
ssh-keyscan -t ed25519 sftp.example.com >> known_hosts
ssh-keygen -lf known_hosts   # compare with the fingerprint you published

4. Chroot and restrict

With OpenSSH, lock each user into its own directory and allow SFTP only:

# /etc/ssh/sshd_config
Match User sftp_acme_invoices
    ChrootDirectory /srv/sftp/%u
    ForceCommand internal-sftp
    PasswordAuthentication no
    AllowTcpForwarding no
    X11Forwarding no
    PermitTTY no

The chroot directory itself must be owned by root and not writable by any other user. Create writable subfolders inside it:

bash
mkdir -p /srv/sftp/sftp_acme_invoices/{inbound,outbound,processed,error}
chown root:root /srv/sftp/sftp_acme_invoices && chmod 755 /srv/sftp/sftp_acme_invoices
chown sftp_acme_invoices: /srv/sftp/sftp_acme_invoices/{inbound,outbound,processed,error}

Reload sshd after editing and test with a second session before you close the first one.

5. Network and key hygiene

  • Allow-list the partner's source IPs in the firewall where they are stable. Do not rely on this alone.
  • Rotate keys on a schedule (yearly is common) and on every staff change. Support two public keys per user during a rotation so nothing breaks.
  • Log every login and transfer (LogLevel VERBOSE in sshd records SFTP file operations) and ship the logs somewhere that the SFTP user cannot reach.
  • Keep personal data (employee, customer, bank details) out of file names, and set a retention period for processed and error. Both KVKK and GDPR expect you to keep personal data only as long as needed.

Folder Layout and File Handoff

/inbound     files waiting to be imported
/outbound    files waiting for the partner to collect
/processed   successfully handled files (kept for the retention period)
/error       files that failed validation or import, plus a reason file

File names should carry the flow, a date or sequence and an extension, for example PO_20261102_0007.csv. This makes duplicates and gaps easy to find.

Atomic uploads. A reader must never see half a file. The sender uploads to a temporary name and renames at the end:

put PO_20261102_0007.csv.part
rename PO_20261102_0007.csv.part PO_20261102_0007.csv

Readers ignore .part files. Where a partner cannot rename, agree on a done marker (PO_20261102_0007.csv.done) or a checksum file (.sha256) and process only when it exists and matches.

A Safe Polling Script With Paramiko

This script polls inbound, skips files that are still changing, downloads the rest, and moves them to processed on the server only after the local copy is complete.

python
import hashlib, time
from pathlib import Path
import paramiko

HOST, USER = "sftp.example.com", "sftp_acme_invoices"
KEY = "/etc/integration/epicor_invoices"
KNOWN_HOSTS = "/etc/integration/known_hosts"
LOCAL = Path("/var/integration/incoming")
MIN_AGE = 60  # seconds without change before a file counts as complete

client = paramiko.SSHClient()
client.load_host_keys(KNOWN_HOSTS)
client.set_missing_host_key_policy(paramiko.RejectPolicy())  # unknown host = fail
client.connect(HOST, port=22, username=USER, key_filename=KEY,
               look_for_keys=False, allow_agent=False, timeout=20)

sftp = client.open_sftp()
try:
    for entry in sftp.listdir_attr("inbound"):
        name = entry.filename
        if name.endswith((".part", ".done", ".tmp")) or name.startswith("."):
            continue
        if time.time() - entry.st_mtime < MIN_AGE:
            continue  # may still be uploading

        target = LOCAL / name
        sftp.get(f"inbound/{name}", str(target))
        if target.stat().st_size != entry.st_size:
            target.unlink()
            continue  # incomplete, try again next run

        digest = hashlib.sha256(target.read_bytes()).hexdigest()
        print(f"received {name} {entry.st_size} bytes sha256={digest}")

        sftp.rename(f"inbound/{name}", f"processed/{name}")
finally:
    sftp.close()
    client.close()

RejectPolicy makes an unknown or changed host key an error instead of a silent accept. On a server that supports it, sftp.posix_rename overwrites an existing target atomically, while rename fails if the target exists. In real use, import the downloaded file into Epicor first, and move it to processed or error depending on the result. Do not delete anything until the import is confirmed.

Scheduling, Retries and Monitoring

  • Schedule the job with cron, a systemd timer, a Windows task or the Epicor System Agent where the step belongs inside Epicor. Every few minutes is enough for most business files.
  • Make it idempotent. A file name or hash that was already imported must not create a second purchase order. Keep a small table of handled files.
  • Retry connection errors with backoff (for example 1, 5, 15 minutes). Do not retry validation errors; move the file to error with a short reason file and alert someone.
  • Monitor three things: the job ran, the oldest file in inbound is not stale, and error is empty. Alert on all three.
  • Audit: keep who sent what, when it was imported and the result, linked to the file hash.

Troubleshooting

SymptomLikely cause
Permission denied (publickey)Wrong key, key not in authorized_keys, or authorized_keys and home directory permissions too open. Check /var/log/auth.log
Connection works, cannot writeThe chroot root is writable by the user (sshd refuses it) or the subfolder is not owned by the user
Host key mismatch or RejectPolicy errorThe server was rebuilt or you are being intercepted. Verify the fingerprint out of band before you update known_hosts
Partial or truncated filesSender is not using temp name plus rename. Add a minimum file age, a done marker or a size check
Duplicate importsJob re-reads files that were not moved. Track handled file names and hashes
Garbled charactersEncoding mismatch between sender and importer. Agree on UTF-8 (or declare the code page) in the file spec
Timestamps off by hoursServer, partner and Epicor use different time zones. Run the server in UTC and name files with UTC dates

Quick Start

  1. List each file flow, its direction, format, partner and owner.
  2. Decide which Epicor tool moves each flow for your version and hosting model, and confirm it with Epicor documentation.
  3. Create one SFTP user per flow with an ed25519 key and no password.
  4. Chroot the user and create inbound, outbound, processed and error.
  5. Publish the host key fingerprint and have partners pin it.
  6. Agree on file naming, temp-name-then-rename and a done marker or checksum.
  7. Schedule the job, make it idempotent and add retries.
  8. Turn on logging, alerts for stale files and errors, and set a retention period.
  9. Write the key rotation date into the calendar.

Summary

A reliable Epicor SFTP integration comes down to a small set of habits: one user per flow, keys instead of passwords, a pinned host key, a chrooted folder layout, atomic file handoff and a monitored schedule. The Epicor side depends on your version and hosting, so verify the tools before you commit to a design.

Veni AI builds and runs ERP integrations like this for manufacturers and other companies. See our data integration service, the manufacturing industry page, or talk to us about your Epicor setup.

Keep reading

Have a process that should run on AI?

Describe one process as it runs today, and we'll show you which repetitive steps an AI application or agent could handle.