# SFTP

SFTP (SSH File Transfer Protocol) works by using a secure shell data stream. It establishes a secure connection and then provides a higher level of protection for data while transferring it.

## SFTP Access

### Using account SSH key integration (preferred way)

Using this method you will not need to copy-paste your key for each environment. It will be linked to your ReadyMage account.

#### Add SSH Key to your account

Navigate to **Account -> Integrations**.

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FnqKrSfOygo8OeAl8ytkZ%2FScreenshot_20240819_172724.png?alt=media&#x26;token=c2a0e355-50b3-403e-af6e-aea0206fe1f8" alt=""><figcaption></figcaption></figure>

Click **Add Key**.

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FubG5CobNIjX2T04AGCSv%2Fimage.png?alt=media&#x26;token=d587acc1-5407-45b3-ba5c-f91bde1422b7" alt=""><figcaption></figcaption></figure>

Enter your SSH Public Key and click **Save**.

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FlfD0PF7aQwjnhFQhnLjT%2FScreenshot_20240816_163034.png?alt=media&#x26;token=f49f1f14-bad9-4c85-871c-f7d3ad74f0b4" alt=""><figcaption></figcaption></figure>

After saving, the SSH key will be partially visible in the integrations.

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FCW7AGTvDR2tQk52jaKXj%2FScreenshot_20240816_161302.png?alt=media&#x26;token=d5582f36-ad36-4c15-ba38-66e3c28cbf51" alt=""><figcaption></figcaption></figure>

#### Grant user access to SFTP

Navigate to **User Portal → Project → Selected Instance → Service Management → SFTP** tab. Click **Add User** and select User by email.

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FcEvFeOsaE7SI3jM3LgIX%2FScreenshot_20240819_172917.png?alt=media&#x26;token=cfde152e-e0dc-4920-b565-4644a83e2c30" alt=""><figcaption></figcaption></figure>

### Using SSH key

Navigate to the **User Portal → Project → Selected Instance → Application Management → SFTP** tab. Click **Add SFTP Key**, fill in your SSH username, and add your SSH Public Key or leave it empty to get a **one-time** generated password.

<figure><img src="https://2103450200-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MKew-XtJKAPabdeTxXg%2Fuploads%2FNScHbM0pdI82zfXmejsS%2FScreenshot_20240819_171556.png?alt=media&#x26;token=a175c566-0eca-4e71-8198-97e5a5c3da81" alt=""><figcaption></figcaption></figure>

## Directory mapping

Following directories are available on the SFTP server and mapped to appropriate directories in Magento 2 root:

* `/import` -> `<magento2_root>/var/import`
* `/export` -> `<magento2_root>/var/export`
* `/media` -> `<magento2_root>/pub/media`

## Connect to SFTP server

Connection details are available in the SFTP tab in the Service Management section.

{% hint style="warning" %}
SFTP does not grant access to Magento 2 and ScandiPWA source files. Code changes and extension installation require [local setup](https://help.readymage.com/project-development/code-customization-and-local-setup).
{% endhint %}

### Connect using FileZilla

To connect to the SFTP server you can use a free cross-platform client like [FileZilla](https://filezilla-project.org/).

1. Open FileZilla.
2. Go to Edit > Settings > Connection > SFTP
3. Add your private SSH key using Add key file button.
4. Enter Host, Username, and Port in Quickconnect fields.
5. Press Quickconnect.
