# mulesoft SFTP Connector - Full Documentation --- product: SFTP Connector version: 2.5 --- # Configure Preferred Authentication > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) enables you to configure preferred authentication methods in the SFTP global configuration of the connector. The following example shows how to configure different authentication methods in Anypoint Studio. 1. In Studio, navigate to the **Global Elements** tab. 2. In the Choose Global Type window, type `sftp` in the search bar. 3. Select **SFTP Config**. 4. Click **OK**. 5. Set **Preferred authentication methods** to **Edit inline**. 6. Click the plus sign to add one of the valid authentication methods: `GSSAPI_WITH_MIC`, `PUBLIC_KEY`, `KEYBOARD_INTERACTIVE`, or `PASSWORD`. 7. Set **Value** to `GSSAPI_WITH_MIC`. 8. Complete the remaining connection fields. 9. Click **Test Connection…​**. 10. Click **OK**. ![SFTP Configuration with preferred authentication field set to GSSAPI\_WITH\_MIC](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-preferred-authentication.png) In the **Configuration XML** editor window, the configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) --- product: SFTP Connector version: 2.6 --- # Configure Preferred Authentication > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) enables you to configure preferred authentication methods in the SFTP global configuration of the connector. The following example shows how to configure different authentication methods in Anypoint Studio. 1. In Studio, navigate to the **Global Elements** tab. 2. In the Choose Global Type window, type `sftp` in the search bar. 3. Select **SFTP Config**. 4. Click **OK**. 5. Set **Preferred authentication methods** to **Edit inline**. 6. Click the plus sign to add one of the valid authentication methods: `GSSAPI_WITH_MIC`, `PUBLIC_KEY`, `KEYBOARD_INTERACTIVE`, or `PASSWORD`. 7. Set **Value** to `GSSAPI_WITH_MIC`. 8. Complete the remaining connection fields. 9. Click **Test Connection…​**. 10. Click **OK**. ![SFTP Configuration with preferred authentication field set to GSSAPI\_WITH\_MIC](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-preferred-authentication.png) In the **Configuration XML** editor window, the configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Configure Preferred Authentication > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) enables you to configure preferred authentication methods in the SFTP global configuration of the connector. The following example shows how to configure different authentication methods in Anypoint Studio. 1. In Studio, navigate to the **Global Elements** tab. 2. In the Choose Global Type window, type `sftp` in the search bar. 3. Select **SFTP Config**. 4. Click **OK**. 5. Set **Preferred authentication methods** to **Edit inline**. 6. Click the plus sign to add one of the valid authentication methods: `GSSAPI_WITH_MIC`, `PUBLIC_KEY`, `KEYBOARD_INTERACTIVE`, or `PASSWORD`. 7. Set **Value** to `GSSAPI_WITH_MIC`. 8. Complete the remaining connection fields. 9. Click **Test Connection…​**. 10. Click **OK**. ![SFTP Configuration with preferred authentication field set to GSSAPI\_WITH\_MIC](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-preferred-authentication.png) In the **Configuration XML** editor window, the configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) --- product: SFTP Connector version: 2.5 --- # Configure Security Parameters of SSH Connection > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following example shows how to configure the Anypoint Connector for SFTP (SFTP Connector) to override security parameters using Anypoint Studio. ## Create a Configuration Override File Follow these steps to create the file: 1. Navigate to your `src/main/resources` folder. 2. Create a config file, for example, `mule_sshd_config` with the following SSHD content. The file follows the format of an `sshd_config` file: ```xml KexAlgorithms ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group18-sha512,diffie-hellman-group17-sha512,diffie-hellman-group16-sha512,diffie-hellman-group14-sha256 Ciphers aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr HostKeyAlgorithms ssh-rsa,rsa-sha2-256,rsa-sha2-512 MACs hmac-sha1,hmac-sha2-256,hmac-sha2-512 ``` ![Contents of the override config file](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-override-config-file-contents.png) 3. Configure the keys and values accordingly. If you do not provide a key, then default values are used. The following example shows the location of the config file within the `src/main/resources` folder: ![Location of the override config file](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-override-config-file-location.png) ## Configure the Override File in Anypoint Studio Follow these steps to configure the override file: 1. In Studio, navigate to the **Global Elements** tab. 2. In the Choose Global Type window, type `sftp` in the search bar. 3. Select **SFTP Config**. 4. Click **OK**. 5. Go to the **Advanced** tab. 6. Under **Security Configuration**, enter `ssh config override file`. 7. Enter the path to the file, for example: `${app.home}/mule_sshd_config`. 8. Complete the remaining connection fields. 9. Click **Test Connection…​**. 10. Click **OK**. ![SFTP Configuration with preferred authentication field set to GSSAPI\_WITH\_MIC](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-override-security-parameters.png) In the **Configuration XML** editor window, the configuration looks like this: ```xml ``` ## Verify the Override File Creation Consider the following points when verifying the file creation: - Search for the log `Read the config file` and verify that the filename and the configuration values fetched from the file are valid. - Find ignored configs with the log line `Config keys found but ignored`. - Check that if the connector is unable to locate the file, then it logs `Couldn’t locate config file`. ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) --- product: SFTP Connector version: 2.6 --- # Configure Security Parameters of SSH Connection > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following example shows how to configure the Anypoint Connector for SFTP (SFTP Connector) to override security parameters using Anypoint Studio. ## Create a Configuration Override File Follow these steps to create the file: 1. Navigate to your `src/main/resources` folder. 2. Create a config file, for example, `mule_sshd_config` with the following SSHD content. The file follows the format of an `sshd_config` file: ```xml KexAlgorithms ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group18-sha512,diffie-hellman-group17-sha512,diffie-hellman-group16-sha512,diffie-hellman-group14-sha256 Ciphers aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr HostKeyAlgorithms ssh-rsa,rsa-sha2-256,rsa-sha2-512 MACs hmac-sha1,hmac-sha2-256,hmac-sha2-512 ``` ![Contents of the override config file](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-override-config-file-contents.png) 3. Configure the keys and values accordingly. If you do not provide a key, then default values are used. The following example shows the location of the config file within the `src/main/resources` folder: ![Location of the override config file](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-override-config-file-location.png) ## Configure the Override File in Anypoint Studio Follow these steps to configure the override file: 1. In Studio, navigate to the **Global Elements** tab. 2. In the Choose Global Type window, type `sftp` in the search bar. 3. Select **SFTP Config**. 4. Click **OK**. 5. Go to the **Advanced** tab. 6. Under **Security Configuration**, enter `ssh config override file`. 7. Enter the path to the file, for example: `${app.home}/mule_sshd_config`. 8. Complete the remaining connection fields. 9. Click **Test Connection…​**. 10. Click **OK**. ![SFTP Configuration with preferred authentication field set to GSSAPI\_WITH\_MIC](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-override-security-parameters.png) In the **Configuration XML** editor window, the configuration looks like this: ```xml ``` ## Verify the Override File Creation Consider the following points when verifying the file creation: - Search for the log `Read the config file` and verify that the filename and the configuration values fetched from the file are valid. - Find ignored configs with the log line `Config keys found but ignored`. - Check that if the connector is unable to locate the file, then it logs `Couldn’t locate config file`. ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Configure Security Parameters of SSH Connection > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following example shows how to configure the Anypoint Connector for SFTP (SFTP Connector) to override security parameters using Anypoint Studio. ## Create a Configuration Override File Follow these steps to create the file: 1. Navigate to your `src/main/resources` folder. 2. Create a config file, for example, `mule_sshd_config` with the following SSHD content. The file follows the format of an `sshd_config` file: ```xml KexAlgorithms ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group18-sha512,diffie-hellman-group17-sha512,diffie-hellman-group16-sha512,diffie-hellman-group14-sha256 Ciphers aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr HostKeyAlgorithms ssh-rsa,rsa-sha2-256,rsa-sha2-512 MACs hmac-sha1,hmac-sha2-256,hmac-sha2-512 ``` ![Contents of the override config file](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-override-config-file-contents.png) 3. Configure the keys and values accordingly. If you do not provide a key, then default values are used. The following example shows the location of the config file within the `src/main/resources` folder: ![Location of the override config file](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-override-config-file-location.png) ## Configure the Override File in Anypoint Studio Follow these steps to configure the override file: 1. In Studio, navigate to the **Global Elements** tab. 2. In the Choose Global Type window, type `sftp` in the search bar. 3. Select **SFTP Config**. 4. Click **OK**. 5. Go to the **Advanced** tab. 6. Under **Security Configuration**, enter `ssh config override file`. 7. Enter the path to the file, for example: `${app.home}/mule_sshd_config`. 8. Complete the remaining connection fields. 9. Click **Test Connection…​**. 10. Click **OK**. ![SFTP Configuration with preferred authentication field set to GSSAPI\_WITH\_MIC](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-override-security-parameters.png) In the **Configuration XML** editor window, the configuration looks like this: ```xml ``` ## Verify the Override File Creation Consider the following points when verifying the file creation: - Search for the log `Read the config file` and verify that the filename and the configuration values fetched from the file are valid. - Find ignored configs with the log line `Config keys found but ignored`. - Check that if the connector is unable to locate the file, then it logs `Couldn’t locate config file`. ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) --- product: SFTP Connector version: 2.5 --- # Connect to an SFTP Server Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following examples show how to configure Anypoint Connector for SFTP (SFTP Connector) global configuration element to: - [Connect to an SFTP Server](#connect-sftp-server) - [Connect to an SFTP Server Through a Proxy](#connect-sftp-server-proxy) - [Configure a Public Key to connect to an SFTP server](#configure-public-key) ## Connect to an SFTP Server To configure the global element to connect to an SFTP Server, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector. 5. If you want EdDSA support, provide the EdDSA dependency by clicking **Configure** under the **Required Libraries** field. 6. Set the **Working Directory** field to `${workingDir}`. This is root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 7. Set the **Host** field to specify the SFTP server host, for example `localhost` or `192.168.0.1`. 8. Set the **Port** field to `${sftpPort}`. 9. Set the **Username** field to `anonymous` and the **Password** field to `password`. 10. On the **Advanced** tab, optionally specify timeout configuration and reconnection strategy. 11. Click **Test Connection** to confirm that Mule can connect with the specified server. 12. Click **OK**. ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-global-configuration-with-required-lib.png) In the Configuration XML editor, the configuration `sftp:config` looks like this: ```xml ``` ## Connect to an SFTP Server Through a Proxy To configure the global element to connect to an SFTP server through a proxy, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector. 5. Set the **Working Directory** field to `${workingDir}`. This is root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 6. Set the **Host** field to `127.0.0.100`. 7. Set the **Port** field to `${SFTP_PORT}`. 8. Set the **Username** field to `muletest1` and the **Password** field to `password`. 9. For the **Sftp proxy config** field, select **Edit inline**, and set the following fields: - **Host**: `localhost` - **Port**: `${proxyPort}` - **Protocol**: `HTTP` The protocol can be either `HTTP` or `SOCKS5`. 10. On the **Advanced** tab, optionally specify a timeout configuration and reconnection strategy. 11. Click **Test Connection** to confirm that Mule can connect with the specified server. 12. Click **OK**. ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-global-configuration-proxy.png) In the **Configuration XML** editor, the configuration `sftp:config` looks like this: ```xml ``` ## Configure a Public Key to Connect to an SFTP Server The following example shows how to configure a public key as the preferred authentication method in your SFTP configuration. The example uses a PEM (Privacy Enhanced Mail) format certificate. 1. In Studio, navigate to the **Global Elements** tab. 2. Click **Create**. 3. Search for `sftp`. 4. Select **SFTP Config**. 5. Click **OK**. 6. In the Global Element Properties window, set **Preferred authentication methods** to **Edit inline**. 7. Click the plus sign to add a new value. 8. In the **Preferred authentication method** window, set **Value** to `PUBLIC_KEY`. 9. Click the plus sign to add a new value. 10. Set **Value** to `PASSWORD`. 11. Set **Host** to `sftp.host.com`. 12. Set **Port** to `22`. 13. Set **Username** to `sftp username`. 14. Set **Password** to `sftp password`. 15. Set **Identity file** to the PEM location folder, for example `Sftp-test-connection/src-main/resources/private.pem`. 16. Set **Passphrase** to the password of the identity file. 17. Click **OK**. ![SFTP Connector Global Element Configuration for public key](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-global-configuration-key.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Connect to an SFTP Server Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following examples show how to configure Anypoint Connector for SFTP (SFTP Connector) global configuration element to: - [Connect to an SFTP Server](#connect-sftp-server) - [Connect to an SFTP Server Through a Proxy](#connect-sftp-server-proxy) - [Configure a Public Key to connect to an SFTP server](#configure-public-key) ## Connect to an SFTP Server To configure the global element to connect to an SFTP Server, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector. 5. If you want EdDSA support, provide the EdDSA dependency by clicking **Configure** under the **Required Libraries** field. 6. Set the **Working Directory** field to `${workingDir}`. This is root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 7. Set the **Host** field to specify the SFTP server host, for example `localhost` or `192.168.0.1`. 8. Set the **Port** field to `${sftpPort}`. 9. Set the **Username** field to `anonymous` and the **Password** field to `password`. 10. On the **Advanced** tab, optionally specify timeout configuration and reconnection strategy. 11. Click **Test Connection** to confirm that Mule can connect with the specified server. 12. Click **OK**. ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-global-configuration-with-required-lib.png) In the Configuration XML editor, the configuration `sftp:config` looks like this: ```xml ``` ## Connect to an SFTP Server Through a Proxy To configure the global element to connect to an SFTP server through a proxy, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector. 5. Set the **Working Directory** field to `${workingDir}`. This is root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 6. Set the **Host** field to `127.0.0.100`. 7. Set the **Port** field to `${SFTP_PORT}`. 8. Set the **Username** field to `muletest1` and the **Password** field to `password`. 9. For the **Sftp proxy config** field, select **Edit inline**, and set the following fields: - **Host**: `localhost` - **Port**: `${proxyPort}` - **Protocol**: `HTTP` The protocol can be either `HTTP` or `SOCKS5`. 10. On the **Advanced** tab, optionally specify a timeout configuration and reconnection strategy. 11. Click **Test Connection** to confirm that Mule can connect with the specified server. 12. Click **OK**. ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-global-configuration-proxy.png) In the **Configuration XML** editor, the configuration `sftp:config` looks like this: ```xml ``` ## Configure a Public Key to Connect to an SFTP Server The following example shows how to configure a public key as the preferred authentication method in your SFTP configuration. The example uses a PEM (Privacy Enhanced Mail) format certificate. > [!IMPORTANT] Avoid storing private keys in your source code repository. For production, use > [secure configuration properties](https://docs.mulesoft.com/mule-runtime/latest/secure-configuration-properties) or a > secrets manager. 1. In Studio, navigate to the **Global Elements** tab. 2. Click **Create**. 3. Search for `sftp`. 4. Select **SFTP Config**. 5. Click **OK**. 6. In the Global Element Properties window, set **Preferred authentication methods** to **Edit inline**. 7. Click the plus sign to add a new value. 8. In the **Preferred authentication method** window, set **Value** to `PUBLIC_KEY`. 9. Click the plus sign to add a new value. 10. Set **Value** to `PASSWORD`. 11. Set **Host** to `sftp.host.com`. 12. Set **Port** to `22`. 13. Set **Username** to `sftp username`. 14. Set **Password** to `sftp password`. 15. Set **Identity file** to reference your PEM file using the `${app.home}` property, for example `${app.home}/keys/private.pem`. Place the PEM file in your project’s `src/main/resources/keys` folder. 16. Set **Passphrase** to the password of the identity file. 17. Click **OK**. ![SFTP Connector Global Element Configuration for public key](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-global-configuration-key.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Connect to an SFTP Server Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt The following examples show how to configure Anypoint Connector for SFTP (SFTP Connector) global configuration element to: - [Connect to an SFTP Server](#connect-sftp-server) - [Connect to an SFTP Server Through a Proxy](#connect-sftp-server-proxy) - [Configure a Public Key to connect to an SFTP server](#configure-public-key) ## Connect to an SFTP Server To configure the global element to connect to an SFTP Server, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector. 5. If you want EdDSA support, provide the EdDSA dependency by clicking **Configure** under the **Required Libraries** field. 6. Set the **Working Directory** field to `${workingDir}`. This is root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 7. Set the **Host** field to specify the SFTP server host, for example `localhost` or `192.168.0.1`. 8. Set the **Port** field to `${sftpPort}`. 9. Set the **Username** field to `anonymous` and the **Password** field to `password`. 10. On the **Advanced** tab, optionally specify timeout configuration and reconnection strategy. 11. Click **Test Connection** to confirm that Mule can connect with the specified server. 12. Click **OK**. ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-global-configuration-with-required-lib.png) In the Configuration XML editor, the configuration `sftp:config` looks like this: ```xml ``` ## Connect to an SFTP Server Through a Proxy To configure the global element to connect to an SFTP server through a proxy, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector. 5. Set the **Working Directory** field to `${workingDir}`. This is root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 6. Set the **Host** field to `127.0.0.100`. 7. Set the **Port** field to `${SFTP_PORT}`. 8. Set the **Username** field to `muletest1` and the **Password** field to `password`. 9. For the **Sftp proxy config** field, select **Edit inline**, and set the following fields: - **Host**: `localhost` - **Port**: `${proxyPort}` - **Protocol**: `HTTP` The protocol can be either `HTTP` or `SOCKS5`. 10. On the **Advanced** tab, optionally specify a timeout configuration and reconnection strategy. 11. Click **Test Connection** to confirm that Mule can connect with the specified server. 12. Click **OK**. ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-global-configuration-proxy.png) In the **Configuration XML** editor, the configuration `sftp:config` looks like this: ```xml ``` ## Configure a Public Key to Connect to an SFTP Server The following example shows how to configure a public key as the preferred authentication method in your SFTP configuration. The example uses a PEM (Privacy Enhanced Mail) format certificate. > [!IMPORTANT] Avoid storing private keys in your source code repository. For production, use > [secure configuration properties](https://docs.mulesoft.com/mule-runtime/latest/secure-configuration-properties) or a > secrets manager. 1. In Studio, navigate to the **Global Elements** tab. 2. Click **Create**. 3. Search for `sftp`. 4. Select **SFTP Config**. 5. Click **OK**. 6. In the Global Element Properties window, set **Preferred authentication methods** to **Edit inline**. 7. Click the plus sign to add a new value. 8. In the **Preferred authentication method** window, set **Value** to `PUBLIC_KEY`. 9. Click the plus sign to add a new value. 10. Set **Value** to `PASSWORD`. 11. Set **Host** to `sftp.host.com`. 12. Set **Port** to `22`. 13. Set **Username** to `sftp username`. 14. Set **Password** to `sftp password`. 15. Set **Identity file** to reference your PEM file using the `${app.home}` property, for example `${app.home}/keys/private.pem`. Place the PEM file in your project’s `src/main/resources/keys` folder. 16. Set **Passphrase** to the password of the identity file. 17. Click **OK**. ![SFTP Connector Global Element Configuration for public key](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-global-configuration-key.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Connect to SFTP Servers Dynamically Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Many integrations require connecting to different servers based on a specific condition, such as: - Connecting to different invoice storage servers depending on the branch that emits an invoice - Connecting to different servers depending on an integration subject, such as in a multi-tenant use case To accommodate these use cases, the Anypoint Connector for SFTP (SFTP Connector) global configuration element supports parameter expressions that evaluate these conditions and connect to the correct server. The following example shows how to configure SFTP Connector to connect dynamically to multiple servers: 1. An HTTP **Listener** source initiates the flow by reading random content posted via HTTP. 2. The File Connector **Read** operation loads a recipients CSV file that contains a random set of SFTP destinations, with columns such as `host`, `user`, and `port`. 3. A DataWeave transformation maps the content and splits the CSV file. 4. A **For Each** component and an SFTP **Write** operation write the contents into each of the SFTP destinations. On each **For Each** iteration, the expressions set in the SFTP global configuration element resolve to a different value and establish different connections to each of the servers. To test this example, create the Mule application, and run and test the application with curl commands: ![Connect to SFTP Servers Dynamically](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-connection-dynamically.png) Figure 1. Connect to SFTP Servers Dynamically flow ## Create the Mule Application To create the Mule flow: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **HTTP Listener** to the Studio canvas. 3. On the **HTTP Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Set the **Path** field to `/multitenant` 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of HTTP Listener in the app. 6. On the **General** tab, set the following fields: - **Host**: `All Interfaces [0.0.0.0] (default)` - **Port**: `8081` 7. Click **OK**. 8. Drag a **Set Variable** component to the right of the **HTTP Listener** source. 9. Set the **Name** field to `content` and the **Value** field to `#[payload]`. 10. Drag the File Connector **Read** operation to the right of the **Set Variable** component. 11. Set the **File Path** field to `recipients.csv`. This reads a CSV file that contains a random set of SFTP destinations with columns such as `host`, `user`, and `port`. 12. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of File Connector in the app. 13. Accept the default settings and click **OK**. 14. On the **MIME Type** tab of the **Read** operation, for the **MIME Type** field, select `application/csv`. ### Configure Additional Components and Operations Continue creating your Mule application by adding additional components and operations: 1. In Studio, drag a **Transform Message** component to the right of the **Read** operation. 2. In the **Output** section of the component, add the following DataWeave code to map the columns of the CSV file: DataWeave script: ```dataweave %dw 2.0 output application/java --- payload map using (row = $) { host: row.Host, user: row.User, password: row.Password} ``` 3. Drag a **For Each** component to the right of the **Transform Message** component. 4. Drag an SFTP **Write** operation into the **For Each** component. On each For Each iteration, the **Write** operation writes the contents into each of the SFTP destinations. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of SFTP Write operation in the app, and set the following fields: - **Host**: `#[payload.host]` - **Username**: `#[payload.username]` - **Password**: `#[payload.password]` 6. Click **OK**. 7. On the configuration screen, set the **Path** field to `demo.txt`. 8. Set the **Content** field to `payload`. 9. Drag a **Set Payload** component to the right of the **For Each** component. 10. Set the **Value** field to `Multicast Ok`. ## Run and Test your Mule Application After creating your Mule application, run and test it: 1. In Studio, save your Mule app. 2. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**. 3. Open a browser and type `http://0.0.0.0:8081/multitenant`. - The information posted through the HTTP Listener source is written to each SFTP site multiple times. Because the listener makes use of the [repeatable streams feature](https://docs.mulesoft.com/mule-runtime/latest/streaming-about), you do not need to worry about consuming the stream multiple times. - The For Each component automatically goes through each line of the CSV file. When reading or listing files, you might be interested in the file’s metadata (for example, the file name, full path, size, timestamp). The connector uses the Mule message attributes to access this information. ## XML for Connecting to SFTP Servers Dynamically Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Connect to SFTP Servers Dynamically Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Many integrations require connecting to different servers based on a specific condition, such as: - Connecting to different invoice storage servers depending on the branch that emits an invoice - Connecting to different servers depending on an integration subject, such as in a multi-tenant use case To accommodate these use cases, the Anypoint Connector for SFTP (SFTP Connector) global configuration element supports parameter expressions that evaluate these conditions and connect to the correct server. The following example shows how to configure SFTP Connector to connect dynamically to multiple servers: 1. An HTTP **Listener** source initiates the flow by reading random content posted via HTTP. 2. The File Connector **Read** operation loads a recipients CSV file that contains a random set of SFTP destinations, with columns such as `host`, `user`, and `port`. 3. A DataWeave transformation maps the content and splits the CSV file. 4. A **For Each** component and an SFTP **Write** operation write the contents into each of the SFTP destinations. On each **For Each** iteration, the expressions set in the SFTP global configuration element resolve to a different value and establish different connections to each of the servers. To test this example, create the Mule application, and run and test the application with curl commands: ![Connect to SFTP Servers Dynamically](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-connection-dynamically.png) Figure 1. Connect to SFTP Servers Dynamically flow ## Create the Mule Application To create the Mule flow: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **HTTP Listener** to the Studio canvas. 3. On the **HTTP Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Set the **Path** field to `/multitenant` 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of HTTP Listener in the app. 6. On the **General** tab, set the following fields: - **Host**: `All Interfaces [0.0.0.0] (default)` - **Port**: `8081` 7. Click **OK**. 8. Drag a **Set Variable** component to the right of the **HTTP Listener** source. 9. Set the **Name** field to `content` and the **Value** field to `#[payload]`. 10. Drag the File Connector **Read** operation to the right of the **Set Variable** component. 11. Set the **File Path** field to `recipients.csv`. This reads a CSV file that contains a random set of SFTP destinations with columns such as `host`, `user`, and `port`. 12. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of File Connector in the app. 13. Accept the default settings and click **OK**. 14. On the **MIME Type** tab of the **Read** operation, for the **MIME Type** field, select `application/csv`. ### Configure Additional Components and Operations Continue creating your Mule application by adding additional components and operations: 1. In Studio, drag a **Transform Message** component to the right of the **Read** operation. 2. In the **Output** section of the component, add the following DataWeave code to map the columns of the CSV file: DataWeave script: ```dataweave %dw 2.0 output application/java --- payload map using (row = $) { host: row.Host, user: row.User, password: row.Password} ``` 3. Drag a **For Each** component to the right of the **Transform Message** component. 4. Drag an SFTP **Write** operation into the **For Each** component. On each For Each iteration, the **Write** operation writes the contents into each of the SFTP destinations. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of SFTP Write operation in the app, and set the following fields: - **Host**: `#[payload.host]` - **Username**: `#[payload.username]` - **Password**: `#[payload.password]` 6. Click **OK**. 7. On the configuration screen, set the **Path** field to `demo.txt`. 8. Set the **Content** field to `payload`. 9. Drag a **Set Payload** component to the right of the **For Each** component. 10. Set the **Value** field to `Multicast Ok`. ## Run and Test your Mule Application After creating your Mule application, run and test it: 1. In Studio, save your Mule app. 2. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**. 3. Open a browser and type `http://0.0.0.0:8081/multitenant`. - The information posted through the HTTP Listener source is written to each SFTP site multiple times. Because the listener makes use of the [repeatable streams feature](https://docs.mulesoft.com/mule-runtime/latest/streaming-about), you do not need to worry about consuming the stream multiple times. - The For Each component automatically goes through each line of the CSV file. When reading or listing files, you might be interested in the file’s metadata (for example, the file name, full path, size, timestamp). The connector uses the Mule message attributes to access this information. ## XML for Connecting to SFTP Servers Dynamically Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Connect to SFTP Servers Dynamically Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Many integrations require connecting to different servers based on a specific condition, such as: - Connecting to different invoice storage servers depending on the branch that emits an invoice - Connecting to different servers depending on an integration subject, such as in a multi-tenant use case To accommodate these use cases, the Anypoint Connector for SFTP (SFTP Connector) global configuration element supports parameter expressions that evaluate these conditions and connect to the correct server. The following example shows how to configure SFTP Connector to connect dynamically to multiple servers: 1. An HTTP **Listener** source initiates the flow by reading random content posted via HTTP. 2. The File Connector **Read** operation loads a recipients CSV file that contains a random set of SFTP destinations, with columns such as `host`, `user`, and `port`. 3. A DataWeave transformation maps the content and splits the CSV file. 4. A **For Each** component and an SFTP **Write** operation write the contents into each of the SFTP destinations. On each **For Each** iteration, the expressions set in the SFTP global configuration element resolve to a different value and establish different connections to each of the servers. To test this example, create the Mule application, and run and test the application with curl commands: ![Connect to SFTP Servers Dynamically](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-connection-dynamically.png) Figure 1. Connect to SFTP Servers Dynamically flow ## Create the Mule Application To create the Mule flow: 1. In the **Mule Palette** view, select **HTTP > Listener**. 2. Drag **HTTP Listener** to the Studio canvas. 3. On the **HTTP Listener** configuration screen, optionally change the value of the **Display Name** field. 4. Set the **Path** field to `/multitenant` 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of HTTP Listener in the app. 6. On the **General** tab, set the following fields: - **Host**: `All Interfaces [0.0.0.0] (default)` - **Port**: `8081` 7. Click **OK**. 8. Drag a **Set Variable** component to the right of the **HTTP Listener** source. 9. Set the **Name** field to `content` and the **Value** field to `#[payload]`. 10. Drag the File Connector **Read** operation to the right of the **Set Variable** component. 11. Set the **File Path** field to `recipients.csv`. This reads a CSV file that contains a random set of SFTP destinations with columns such as `host`, `user`, and `port`. 12. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of File Connector in the app. 13. Accept the default settings and click **OK**. 14. On the **MIME Type** tab of the **Read** operation, for the **MIME Type** field, select `application/csv`. ### Configure Additional Components and Operations Continue creating your Mule application by adding additional components and operations: 1. In Studio, drag a **Transform Message** component to the right of the **Read** operation. 2. In the **Output** section of the component, add the following DataWeave code to map the columns of the CSV file: DataWeave script: ```dataweave %dw 2.0 output application/java --- payload map using (row = $) { host: row.Host, user: row.User, password: row.Password} ``` 3. Drag a **For Each** component to the right of the **Transform Message** component. 4. Drag an SFTP **Write** operation into the **For Each** component. On each For Each iteration, the **Write** operation writes the contents into each of the SFTP destinations. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of SFTP Write operation in the app, and set the following fields: - **Host**: `#[payload.host]` - **Username**: `#[payload.username]` - **Password**: `#[payload.password]` 6. Click **OK**. 7. On the configuration screen, set the **Path** field to `demo.txt`. 8. Set the **Content** field to `payload`. 9. Drag a **Set Payload** component to the right of the **For Each** component. 10. Set the **Value** field to `Multicast Ok`. ## Run and Test your Mule Application After creating your Mule application, run and test it: 1. In Studio, save your Mule app. 2. Click the project name in **Package Explorer** and then click **Run** > **Run As** > **Mule Application**. 3. Open a browser and type `http://0.0.0.0:8081/multitenant`. - The information posted through the HTTP Listener source is written to each SFTP site multiple times. Because the listener makes use of the [repeatable streams feature](https://docs.mulesoft.com/mule-runtime/latest/streaming-about), you do not need to worry about consuming the stream multiple times. - The For Each component automatically goes through each line of the CSV file. When reading or listing files, you might be interested in the file’s metadata (for example, the file name, full path, size, timestamp). The connector uses the Mule message attributes to access this information. ## XML for Connecting to SFTP Servers Dynamically Paste this code into your Studio XML editor to quickly load the flow for this example into your Mule app: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Copy and Move Files with the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) **Copy** and **Move** operations enable you to copy and move files or directories on demand. While SFTP has a native concept of copying and moving, FTP does not. FTP Connector simulates these operations by downloading file content and writing it to a new location, using concurrent streams that start writing and reading at the same time. Because these operations create significant network overhead, use them wisely. Note that the SFTP Connector **Move** operation does not impact network overhead. ## Configure the Copy Operation in Studio To add and configure the **Copy** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Copy** operation. 2. Drag the **Copy** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Source path** field to the path of the file to copy, for example, `source.txt`. 6. In the **Target path** field, enter the directory path into which to copy the file, for example, `backup`. 7. Set the **Rename to** field to rename the file as part of the operation, for example, `renamed.txt`. This field must be a filename, not a path. If this attribute is not provided, the original filename is used. ![Copy operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-copy-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Configure the Move Operation in Studio To add and configure the **Move** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Move** operation. 2. Drag the **Move** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Source path** field to the path of the file to move, for example, `source.txt`. 6. In the **Target path** field, enter the directory path into which to move the file, for example `backup`. 7. Set the **Rename to** field to rename the file as part of the operation, for example, `renamed.txt`. This field must be a filename, not a path. If this attribute is not provided, the original filename is used. ![Move operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-move-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Copy and Move Files with the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) **Copy** and **Move** operations enable you to copy and move files or directories on demand. While SFTP has a native concept of copying and moving, FTP does not. FTP Connector simulates these operations by downloading file content and writing it to a new location, using concurrent streams that start writing and reading at the same time. Because these operations create significant network overhead, use them wisely. Note that the SFTP Connector **Move** operation does not impact network overhead. ## Configure the Copy Operation in Studio To add and configure the **Copy** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Copy** operation. 2. Drag the **Copy** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Source path** field to the path of the file to copy, for example, `source.txt`. 6. In the **Target path** field, enter the directory path into which to copy the file, for example, `backup`. 7. Set the **Rename to** field to rename the file as part of the operation, for example, `renamed.txt`. This field must be a filename, not a path. If this attribute is not provided, the original filename is used. ![Copy operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-copy-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Configure the Move Operation in Studio To add and configure the **Move** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Move** operation. 2. Drag the **Move** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Source path** field to the path of the file to move, for example, `source.txt`. 6. In the **Target path** field, enter the directory path into which to move the file, for example `backup`. 7. Set the **Rename to** field to rename the file as part of the operation, for example, `renamed.txt`. This field must be a filename, not a path. If this attribute is not provided, the original filename is used. ![Move operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-move-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Copy and Move Files with the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) **Copy** and **Move** operations enable you to copy and move files or directories on demand. While SFTP has a native concept of copying and moving, FTP does not. FTP Connector simulates these operations by downloading file content and writing it to a new location, using concurrent streams that start writing and reading at the same time. Because these operations create significant network overhead, use them wisely. Note that the SFTP Connector **Move** operation does not impact network overhead. ## Configure the Copy Operation in Studio To add and configure the **Copy** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Copy** operation. 2. Drag the **Copy** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Source path** field to the path of the file to copy, for example, `source.txt`. 6. In the **Target path** field, enter the directory path into which to copy the file, for example, `backup`. 7. Set the **Rename to** field to rename the file as part of the operation, for example, `renamed.txt`. This field must be a filename, not a path. If this attribute is not provided, the original filename is used. ![Copy operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-copy-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Configure the Move Operation in Studio To add and configure the **Move** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Move** operation. 2. Drag the **Move** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Source path** field to the path of the file to move, for example, `source.txt`. 6. In the **Target path** field, enter the directory path into which to move the file, for example `backup`. 7. Set the **Rename to** field to rename the file as part of the operation, for example, `renamed.txt`. This field must be a filename, not a path. If this attribute is not provided, the original filename is used. ![Move operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-move-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Create a Directory Using SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Create directory** operation that enables you to create a directory of a given name. If the reason for creating the directory is to immediately write, copy, or move content to the directory, then use the **Write**, **Copy**, or **Move** operations with the **Create parent directories** field set to **TRUE**. ## Configure the Create Directory Operation in Studio To add and configure the **Create directory** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Create directory** operation. 2. Drag the **Create directory** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Directory path** field to the new directory’s path name, for example, `~/newFolder`. The following screenshot shows the **Create directory** operation configuration: ![Create directory operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-create-directory-operation.png) Figure 1. Create directory operation configuration In the XML editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Create a Directory Using SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Create directory** operation that enables you to create a directory of a given name. If the reason for creating the directory is to immediately write, copy, or move content to the directory, then use the **Write**, **Copy**, or **Move** operations with the **Create parent directories** field set to **TRUE**. ## Configure the Create Directory Operation in Studio To add and configure the **Create directory** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Create directory** operation. 2. Drag the **Create directory** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Directory path** field to the new directory’s path name, for example, `~/newFolder`. The following screenshot shows the **Create directory** operation configuration: ![Create directory operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-create-directory-operation.png) Figure 1. Create directory operation configuration In the XML editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Create a Directory Using SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Create directory** operation that enables you to create a directory of a given name. If the reason for creating the directory is to immediately write, copy, or move content to the directory, then use the **Write**, **Copy**, or **Move** operations with the **Create parent directories** field set to **TRUE**. ## Configure the Create Directory Operation in Studio To add and configure the **Create directory** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Create directory** operation. 2. Drag the **Create directory** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Directory path** field to the new directory’s path name, for example, `~/newFolder`. The following screenshot shows the **Create directory** operation configuration: ![Create directory operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-create-directory-operation.png) Figure 1. Create directory operation configuration In the XML editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Disable Pooling in the SFTP Connector Configuration > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Disable connection pooling in the Anypoint Connector for SFTP (SFTP Connector) configuration to make sure no connection is active if there is nothing to transfer. 1. In Studio, navigate to the **Global Elements** tab. 2. Select the **SFTP Connector** config. 3. Click **Edit**. 4. In the Global Elements properties tab, click the **Advanced** tab. 5. Set **Pooling profile** to **Edit inline**. 6. Set the values of **Max active**, **Max idle**, and **Max wait** to `0` to ensure that no connection is active if there is nothing to transfer. ![SFTP Connection pooling configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-pooling.png) ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Disable Pooling in the SFTP Connector Configuration > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Disable connection pooling in the Anypoint Connector for SFTP (SFTP Connector) configuration to make sure no connection is active if there is nothing to transfer. 1. In Studio, navigate to the **Global Elements** tab. 2. Select the **SFTP Connector** config. 3. Click **Edit**. 4. In the Global Elements properties tab, click the **Advanced** tab. 5. Set **Pooling profile** to **Edit inline**. 6. Set the values of **Max active**, **Max idle**, and **Max wait** to `0` to ensure that no connection is active if there is nothing to transfer. ![SFTP Connection pooling configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-pooling.png) ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Disable Pooling in the SFTP Connector Configuration > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Disable connection pooling in the Anypoint Connector for SFTP (SFTP Connector) configuration to make sure no connection is active if there is nothing to transfer. 1. In Studio, navigate to the **Global Elements** tab. 2. Select the **SFTP Connector** config. 3. Click **Edit**. 4. In the Global Elements properties tab, click the **Advanced** tab. 5. Set **Pooling profile** to **Edit inline**. 6. Set the values of **Max active**, **Max idle**, and **Max wait** to `0` to ensure that no connection is active if there is nothing to transfer. ![SFTP Connection pooling configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-pooling.png) ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # List Files Using the SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **List** operation that returns a list of messages representing files or folders in the directory path: - The path you define in the **Directory path** field can be absolute, or it can be relative to a working directory. - By default, the operation does not read or list files or folders within any subfolders of the directory path. - To list files or folders within any subfolders, set the **Recursive** field to **TRUE**. ## Configure the List Operation in Studio To add and configure the **List** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **List** operation. 2. Drag the **List** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Directory path** field to `~/dropFolder` to set the path of the file to list. ![List operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-list-operation-1.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Examples ### Basic use case The following XML example lists the folder contents of messages in the directory path without the subfolder contents. The **For Each** and **Choice** components manage each directory in the list differently from the way they manage each file: ```xml ``` ### Poll a Directory You can combine a **Scheduler** source with the SFTP **List** operation to poll a directory to look for new files to process. > [!NOTE] For automatic polling, use the SFTP [On New or Updated File](https://docs.mulesoft.com/sftp-connector/2.5/sftp-on-new-file) operation > which enables you to optionally set post-processing options to automatically move or delete files. In the following poll directory example, a flow lists the contents of a folder once per second. The flow then processes the files one by one, deleting each file after it is processed because there is a **Delete** operation in the **For Each** component. The following screenshot shows the flow in Studio: ![Pool a directory flow in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-list-operation-2.png) To create the flow, follow these steps: 1. In Studio, drag the **Scheduler** component onto the Studio canvas. 2. Drag the SFTP **List** operation to the right of **Scheduler**. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Directory path** field to `/config/dropFolder` to set the path of the file to list. 6. Drag a **For each** component to the right of the **List** operation. 7. Drag a **Flow Reference** component inside the **For each** component. 8. Set the **Flow name** field to `processFile` to specify the flow reference that process the files. 9. Drag an SFTP **Delete** operation to the right of the **Flow Reference** component. 10. Set the **Connector configuration** field to the previously configured connection in the **List** operation. 11. Set the **Path** field to `#[payload]`. 12. Drag a **Transform Message** component below the first flow. 13. Select the new flow and change the **Name** field to `processFile`. 14. Drag an SFTP **Read** operation to the left of the **Transform Message** component and set the **Path** field to `#[payload]`. 15. Select the **Transform Message** component in the new flow, and in the **Output** view, paste the following DataWeave expression: ```dataWeave %dw 2.0 output application/json --- characters: payload.characters.*name map ( (item, index) -> {name: item} ) ``` 16. Drag a **Logger** component to the right of **Transform Message**. 17. Set the **Message** field to `payload`. 18. Drag an Objet Store **Store** operation to the right of **Logger**. 19. Set the **Key** field to `test-file-' random() as String '.json'`, and **Value** to `payload`. 20. Save your Mule application. In the **Configuration XML** editor, the configuration looks like this: ```xml ?xml version="1.0" encoding="UTF-8"?> {name: item} )]]> ``` ## Match Filter When listing files, use the **File Matching Rules** field, which accepts files that match the specified criteria. This field defines the possible attributes to either accept or reject a file. These attributes are optional and ignored if you do not provide values for them. Use an `AND` operator to combine individual attributes. To configure the field in Studio, set the **File Matching Rules** field to **Edit inline** and complete the desired attributes: - **Timestamp since** Files created before this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead. - **Timestamp until** Files created after this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead. - **Not updated in the last** Minimum time that should pass since a file was last updated to not be rejected. This attribute works in tandem with **Time unit**. - **Updated in the last** Maximum time that should pass from when a file was last updated to not be rejected. This attribute works in tandem with **Time unit**. - **Time unit** A **Not updated in the last** attributes. Defaults to `MILLISECONDS`. - **Filename pattern** Similar to the current filename pattern filter but more powerful. Glob expressions (default) and regex are supported. You can select which one to use by setting a prefix, for example, `glob:*.{java, js}` or `regex:[0-9]test.csv`. - **Path pattern** Same as **Filename pattern** but applies over the entire file path rather than just a filename. - **Directories** Match only if the file is a directory. - **Regular files** Match only if the file is a regular file. - **Sym links**\` Match only if the file is a symbolic link. - **Min size** Inclusive lower boundary for the file size, expressed in bytes. - **Max size** Inclusive upper boundary for the file size, expressed in bytes. ![File Matching Rules field configuration](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-list-operation-3.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ### External File System Matcher SFTP Connector enables you to use an external file system matcher. Configure the matcher as case sensitive or insensitive in the **Case sensitive** field. ![Case sensitive field set to TRUE](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-list-operation-4.png) In the **Configuration XML** editor, the `caseSensitive` configuration looks like this: ```xml ``` ### Top-Level, Reusable Matcher You can use the file matcher as either a named top-level element that enables reuse or as an inner element that is proprietary to a particular component. The following example shows a top-level reusable matcher: ```xml ... ``` ### Inner Nonreusable Matcher The following example shows an inner nonreusable matcher: ```xml ... ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # List Files Using the SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **List** operation that returns a list of messages representing files or folders in the directory path: - The path you define in the **Directory path** field can be absolute, or it can be relative to a working directory. - By default, the operation does not read or list files or folders within any subfolders of the directory path. - To list files or folders within any subfolders, set the **Recursive** field to **TRUE**. ## Configure the List Operation in Studio To add and configure the **List** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **List** operation. 2. Drag the **List** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Directory path** field to `~/dropFolder` to set the path of the file to list. ![List operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-list-operation-1.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Examples ### Basic use case The following XML example lists the folder contents of messages in the directory path without the subfolder contents. The **For Each** and **Choice** components manage each directory in the list differently from the way they manage each file: ```xml ``` ### Poll a Directory You can combine a **Scheduler** source with the SFTP **List** operation to poll a directory to look for new files to process. > [!NOTE] For automatic polling, use the SFTP [On New or Updated File](https://docs.mulesoft.com/sftp-connector/2.6/sftp-on-new-file) operation > which enables you to optionally set post-processing options to automatically move or delete files. In the following poll directory example, a flow lists the contents of a folder once per second. The flow then processes the files one by one, deleting each file after it is processed because there is a **Delete** operation in the **For Each** component. The following screenshot shows the flow in Studio: ![Pool a directory flow in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-list-operation-2.png) To create the flow, follow these steps: 1. In Studio, drag the **Scheduler** component onto the Studio canvas. 2. Drag the SFTP **List** operation to the right of **Scheduler**. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Directory path** field to `/config/dropFolder` to set the path of the file to list. 6. Drag a **For each** component to the right of the **List** operation. 7. Drag a **Flow Reference** component inside the **For each** component. 8. Set the **Flow name** field to `processFile` to specify the flow reference that process the files. 9. Drag an SFTP **Delete** operation to the right of the **Flow Reference** component. 10. Set the **Connector configuration** field to the previously configured connection in the **List** operation. 11. Set the **Path** field to `#[payload]`. 12. Drag a **Transform Message** component below the first flow. 13. Select the new flow and change the **Name** field to `processFile`. 14. Drag an SFTP **Read** operation to the left of the **Transform Message** component and set the **Path** field to `#[payload]`. 15. Select the **Transform Message** component in the new flow, and in the **Output** view, paste the following DataWeave expression: ```dataWeave %dw 2.0 output application/json --- characters: payload.characters.*name map ( (item, index) -> {name: item} ) ``` 16. Drag a **Logger** component to the right of **Transform Message**. 17. Set the **Message** field to `payload`. 18. Drag an Objet Store **Store** operation to the right of **Logger**. 19. Set the **Key** field to `test-file-' random() as String '.json'`, and **Value** to `payload`. 20. Save your Mule application. In the **Configuration XML** editor, the configuration looks like this: ```xml ?xml version="1.0" encoding="UTF-8"?> {name: item} )]]> ``` ## Match Filter When listing files, use the **File Matching Rules** field, which accepts files that match the specified criteria. This field defines the possible attributes to either accept or reject a file. These attributes are optional and ignored if you do not provide values for them. Use an `AND` operator to combine individual attributes. To configure the field in Studio, set the **File Matching Rules** field to **Edit inline** and complete the desired attributes: - **Timestamp since** Files created before this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead. - **Timestamp until** Files created after this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead. - **Not updated in the last** Minimum time that should pass since a file was last updated to not be rejected. This attribute works in tandem with **Time unit**. - **Updated in the last** Maximum time that should pass from when a file was last updated to not be rejected. This attribute works in tandem with **Time unit**. - **Time unit** A **Not updated in the last** attributes. Defaults to `MILLISECONDS`. - **Filename pattern** Similar to the current filename pattern filter but more powerful. Glob expressions (default) and regex are supported. You can select which one to use by setting a prefix, for example, `glob:*.{java, js}` or `regex:[0-9]test.csv`. - **Path pattern** Same as **Filename pattern** but applies over the entire file path rather than just a filename. - **Directories** Match only if the file is a directory. - **Regular files** Match only if the file is a regular file. - **Sym links**\` Match only if the file is a symbolic link. - **Min size** Inclusive lower boundary for the file size, expressed in bytes. - **Max size** Inclusive upper boundary for the file size, expressed in bytes. ![File Matching Rules field configuration](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-list-operation-3.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ### External File System Matcher SFTP Connector enables you to use an external file system matcher. Configure the matcher as case sensitive or insensitive in the **Case sensitive** field. ![Case sensitive field set to TRUE](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-list-operation-4.png) In the **Configuration XML** editor, the `caseSensitive` configuration looks like this: ```xml ``` ### Top-Level, Reusable Matcher You can use the file matcher as either a named top-level element that enables reuse or as an inner element that is proprietary to a particular component. The following example shows a top-level reusable matcher: ```xml ... ``` ### Inner Nonreusable Matcher The following example shows an inner nonreusable matcher: ```xml ... ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # List Files Using the SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **List** operation that returns a list of messages representing files or folders in the directory path: - The path you define in the **Directory path** field can be absolute, or it can be relative to a working directory. - By default, the operation does not read or list files or folders within any subfolders of the directory path. - To list files or folders within any subfolders, set the **Recursive** field to **TRUE**. ## Configure the List Operation in Studio To add and configure the **List** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **List** operation. 2. Drag the **List** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Directory path** field to `~/dropFolder` to set the path of the file to list. ![List operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-list-operation-1.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Examples ### Basic use case The following XML example lists the folder contents of messages in the directory path without the subfolder contents. The **For Each** and **Choice** components manage each directory in the list differently from the way they manage each file: ```xml ``` ### Poll a Directory You can combine a **Scheduler** source with the SFTP **List** operation to poll a directory to look for new files to process. > [!NOTE] For automatic polling, use the SFTP [On New or Updated File](https://docs.mulesoft.com/sftp-connector/latest/sftp-on-new-file) operation > which enables you to optionally set post-processing options to automatically move or delete files. In the following poll directory example, a flow lists the contents of a folder once per second. The flow then processes the files one by one, deleting each file after it is processed because there is a **Delete** operation in the **For Each** component. The following screenshot shows the flow in Studio: ![Pool a directory flow in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-list-operation-2.png) To create the flow, follow these steps: 1. In Studio, drag the **Scheduler** component onto the Studio canvas. 2. Drag the SFTP **List** operation to the right of **Scheduler**. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Directory path** field to `/config/dropFolder` to set the path of the file to list. 6. Drag a **For each** component to the right of the **List** operation. 7. Drag a **Flow Reference** component inside the **For each** component. 8. Set the **Flow name** field to `processFile` to specify the flow reference that process the files. 9. Drag an SFTP **Delete** operation to the right of the **Flow Reference** component. 10. Set the **Connector configuration** field to the previously configured connection in the **List** operation. 11. Set the **Path** field to `#[payload]`. 12. Drag a **Transform Message** component below the first flow. 13. Select the new flow and change the **Name** field to `processFile`. 14. Drag an SFTP **Read** operation to the left of the **Transform Message** component and set the **Path** field to `#[payload]`. 15. Select the **Transform Message** component in the new flow, and in the **Output** view, paste the following DataWeave expression: ```dataWeave %dw 2.0 output application/json --- characters: payload.characters.*name map ( (item, index) -> {name: item} ) ``` 16. Drag a **Logger** component to the right of **Transform Message**. 17. Set the **Message** field to `payload`. 18. Drag an Objet Store **Store** operation to the right of **Logger**. 19. Set the **Key** field to `test-file-' random() as String '.json'`, and **Value** to `payload`. 20. Save your Mule application. In the **Configuration XML** editor, the configuration looks like this: ```xml ?xml version="1.0" encoding="UTF-8"?> {name: item} )]]> ``` ## Match Filter When listing files, use the **File Matching Rules** field, which accepts files that match the specified criteria. This field defines the possible attributes to either accept or reject a file. These attributes are optional and ignored if you do not provide values for them. Use an `AND` operator to combine individual attributes. To configure the field in Studio, set the **File Matching Rules** field to **Edit inline** and complete the desired attributes: - **Timestamp since** Files created before this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead. - **Timestamp until** Files created after this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead. - **Not updated in the last** Minimum time that should pass since a file was last updated to not be rejected. This attribute works in tandem with **Time unit**. - **Updated in the last** Maximum time that should pass from when a file was last updated to not be rejected. This attribute works in tandem with **Time unit**. - **Time unit** A **Not updated in the last** attributes. Defaults to `MILLISECONDS`. - **Filename pattern** Similar to the current filename pattern filter but more powerful. Glob expressions (default) and regex are supported. You can select which one to use by setting a prefix, for example, `glob:*.{java, js}` or `regex:[0-9]test.csv`. - **Path pattern** Same as **Filename pattern** but applies over the entire file path rather than just a filename. - **Directories** Match only if the file is a directory. - **Regular files** Match only if the file is a regular file. - **Sym links**\` Match only if the file is a symbolic link. - **Min size** Inclusive lower boundary for the file size, expressed in bytes. - **Max size** Inclusive upper boundary for the file size, expressed in bytes. ![File Matching Rules field configuration](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-list-operation-3.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ### External File System Matcher SFTP Connector enables you to use an external file system matcher. Configure the matcher as case sensitive or insensitive in the **Case sensitive** field. ![Case sensitive field set to TRUE](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-list-operation-4.png) In the **Configuration XML** editor, the `caseSensitive` configuration looks like this: ```xml ``` ### Top-Level, Reusable Matcher You can use the file matcher as either a named top-level element that enables reuse or as an inner element that is proprietary to a particular component. The following example shows a top-level reusable matcher: ```xml ... ``` ### Inner Nonreusable Matcher The following example shows an inner nonreusable matcher: ```xml ... ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Read a File Using the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Read** operation that reads a file at any point in the flow. The operation reads the file in the given path and returns a Mule message with the following attributes: - The file’s content as the payload - The file’s metadata in the message attributes - If the file does not exist, you receive an `SFTP:ILLEGAL_PATH` error Note that the operation does not read directories. ## Configure the Read Operation in Studio To add and configure the **Read** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Read** operation. 2. Drag the **Read** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **File Path** field to the path of the file to read, for example, `#[path]`. 6. In the **Advanced** tab, set the **MIME Type** field to `application/xml` and the **Encoding** field to `ISO 10646/Unicode(UTF-8)`. The following screenshot shows the **Read** operation configuration: ![Read operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-read-operation.png) Figure 1. Read operation configuration In the XML editor, the `` configuration looks like this: ```xml ``` ## Transactions Per Second The following table compares the total requests per second (TPS) and average success TPS for the **Read** operation of the SFTP Connector versions:
Connector versionMule runtime engine versionTotal requests for v1.6.1Total requests for v2.0.1Average success TPS for v1.6.1Average success TPS for v2.0.0Percentage of decreased TPS performance

1.6.1 vs 2.0.0

4.4.1

301,377.40

247,614.40

1,674

1,375.60

-18

1.6.1 vs 2.0.0

4.5.0

326,915.80

247,296.20

1,816

1,374

-24

## MIME Types and Encoding Each connector tries to determine a file’s MIME type from its extension. You can force the MIME type to a different value with the **MIME Type** (`outputMimeType`) parameter. The same process works for encoding. By default, the connector assumes that the default encoding in the Mule runtime matches the MIME type of the file, however, you can set the encoding through the **Encoding** (`outputEncoding`) parameter. ## Why MIME Types Matter DataWeave expressions are embeddable inside operations that generate payloads and other values. Having the correct MIME type set helps DataWeave auto-assign types and also generate the correct outputs. Also, maximizing the use of DataSense’s functionality improves the user experience. ## File Locks File system level locks are not possible in FTP or SFTP, so each operation uses a Mule lock that protects only the file from other flows in the same Mule application. These locks do not protect the file from external processes. However, if the Mule application is running on a cluster, the lock is distributed. The file lock is automatically released when any of the following occurs: - The Mule flow that locked the file ends - The file content has been fully read > [!NOTE] If the file is already locked by someone else, the connector cannot unlock it, resulting > in a `FTP:FILE_LOCK` error. ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Read a File Using the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Read** operation that reads a file at any point in the flow. The operation reads the file in the given path and returns a Mule message with the following attributes: - The file’s content as the payload - The file’s metadata in the message attributes - If the file does not exist, you receive an `SFTP:ILLEGAL_PATH` error Note that the operation does not read directories. ## Configure the Read Operation in Studio To add and configure the **Read** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Read** operation. 2. Drag the **Read** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **File Path** field to the path of the file to read, for example, `#[path]`. 6. In the **Advanced** tab, set the **MIME Type** field to `application/xml` and the **Encoding** field to `ISO 10646/Unicode(UTF-8)`. The following screenshot shows the **Read** operation configuration: ![Read operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-read-operation.png) Figure 1. Read operation configuration In the XML editor, the `` configuration looks like this: ```xml ``` ## Transactions Per Second The following table compares the total requests per second (TPS) and average success TPS for the **Read** operation of the SFTP Connector versions:
Connector versionMule runtime engine versionTotal requests for v1.6.1Total requests for v2.0.1Average success TPS for v1.6.1Average success TPS for v2.0.0Percentage of decreased TPS performance

1.6.1 vs 2.0.0

4.4.1

301,377.40

247,614.40

1,674

1,375.60

-18

1.6.1 vs 2.0.0

4.5.0

326,915.80

247,296.20

1,816

1,374

-24

## MIME Types and Encoding Each connector tries to determine a file’s MIME type from its extension. You can force the MIME type to a different value with the **MIME Type** (`outputMimeType`) parameter. The same process works for encoding. By default, the connector assumes that the default encoding in the Mule runtime matches the MIME type of the file, however, you can set the encoding through the **Encoding** (`outputEncoding`) parameter. ## Why MIME Types Matter DataWeave expressions are embeddable inside operations that generate payloads and other values. Having the correct MIME type set helps DataWeave auto-assign types and also generate the correct outputs. Also, maximizing the use of DataSense’s functionality improves the user experience. ## File Locks File system level locks are not possible in FTP or SFTP, so each operation uses a Mule lock that protects only the file from other flows in the same Mule application. These locks do not protect the file from external processes. However, if the Mule application is running on a cluster, the lock is distributed. The file lock is automatically released when any of the following occurs: - The Mule flow that locked the file ends - The file content has been fully read > [!NOTE] If the file is already locked by someone else, the connector cannot unlock it, resulting > in a `FTP:FILE_LOCK` error. ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Read a File Using the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Read** operation that reads a file at any point in the flow. The operation reads the file in the given path and returns a Mule message with the following attributes: - The file’s content as the payload - The file’s metadata in the message attributes - If the file does not exist, you receive an `SFTP:ILLEGAL_PATH` error Note that the operation does not read directories. ## Configure the Read Operation in Studio To add and configure the **Read** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Read** operation. 2. Drag the **Read** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **File Path** field to the path of the file to read, for example, `#[path]`. 6. In the **Advanced** tab, set the **MIME Type** field to `application/xml` and the **Encoding** field to `ISO 10646/Unicode(UTF-8)`. The following screenshot shows the **Read** operation configuration: ![Read operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-read-operation.png) Figure 1. Read operation configuration In the XML editor, the `` configuration looks like this: ```xml ``` ## Transactions Per Second The following table compares the total requests per second (TPS) and average success TPS for the **Read** operation of the SFTP Connector versions:
Connector versionMule runtime engine versionTotal requests for v1.6.1Total requests for v2.0.1Average success TPS for v1.6.1Average success TPS for v2.0.0Percentage of decreased TPS performance

1.6.1 vs 2.0.0

4.4.1

301,377.40

247,614.40

1,674

1,375.60

-18

1.6.1 vs 2.0.0

4.5.0

326,915.80

247,296.20

1,816

1,374

-24

## MIME Types and Encoding Each connector tries to determine a file’s MIME type from its extension. You can force the MIME type to a different value with the **MIME Type** (`outputMimeType`) parameter. The same process works for encoding. By default, the connector assumes that the default encoding in the Mule runtime matches the MIME type of the file, however, you can set the encoding through the **Encoding** (`outputEncoding`) parameter. ## Why MIME Types Matter DataWeave expressions are embeddable inside operations that generate payloads and other values. Having the correct MIME type set helps DataWeave auto-assign types and also generate the correct outputs. Also, maximizing the use of DataSense’s functionality improves the user experience. ## File Locks File system level locks are not possible in FTP or SFTP, so each operation uses a Mule lock that protects only the file from other flows in the same Mule application. These locks do not protect the file from external processes. However, if the Mule application is running on a cluster, the lock is distributed. The file lock is automatically released when any of the following occurs: - The Mule flow that locked the file ends - The file content has been fully read > [!NOTE] If the file is already locked by someone else, the connector cannot unlock it, resulting > in a `FTP:FILE_LOCK` error. ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # SFTP Connector 2.5 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides access to files and folders on an SFTP server. SFTP connector operations manage file transfers over the SFTP (Secure File Transfer Protocol) protocol. The connector’s main features include: - The ability to read files or list directory contents on demand - Support for common SFTP operations such as creating directories, copying, moving, renaming, and deleting files - Support for locking files - File matching functionality - A design that is consistent with that of File Connector and FTP Connector The same set of operations is available on these connectors, and they behave similarly. ## Representation of File Attributes Mule 4 provides a message structure of a payload and attributes in which the data moves around, making that payload a file content. The attributes provide an object that contains metadata on the payload and information such as the file’s name, path, size, and timestamps. For FTP Connector and SFTP Connector, these attributes are known as _file attributes_. The Mule message contains the concepts of encoding and MIME type. These describe the format in which a payload is represented. The file attributes describe a file’s encoding and MIME type. ## Before You Begin To use this connector, you must be familiar with: - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have access to Anypoint Platform and Anypoint Studio. ## Next Step After you complete the prerequisites, you are ready to create your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/sftp-connector/2.5/sftp-studio). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # SFTP Connector 2.5 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides access to files and folders on a SFTP server. Release Notes: [SFTP Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/connector-sftp) > [!NOTE] PPK (Private Key) file does not support identity file for SFTP Connector. ## Configurations --- ### Default Configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

Connection

The connection types to provide to this configuration.

x

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read. This allows a file write to complete before processing. If no value is provided, the check will not be performed. When enabled, Mule waits the specified time between calls and performs two size checks. If both checks return the same value, the file is ready to read. This attribute works in tandem with Time Between Size Check Unit.

Time Between Size Check Unit

Enumeration, is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit that qualifies the Time Between Size Check attribute.

MILLISECONDS

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform will expire the instance at the exact moment that it becomes eligible. Mule runtime engine purges the instances when it sees it fit.

#### Connection Types ##### SFTP Connection A file system provider that provides instances of SFTP file system from instances of SFTP Connector. ###### Parameters
NameTypeDescriptionDefault ValueRequired

Working Directory

String

The directory designated as the root of every relative path used with this connector. If not provided, it defaults to the remote server default. Define a working directory because some SFTP servers do not return output for the present working directory command. While the behavior of the SFTP server side cannot be controlled, setting this value mitigates such scenario.

Preferred Authentication Methods

Array of enumeration is one of:

  • GSSAPI_WITH_MIC

  • PUBLIC_KEY

  • KEYBOARD_INTERACTIVE

  • PASSWORD

Set of authentication methods used by the SFTP client. Valid values are: GSSAPI_WITH_MIC, PUBLIC_KEY, KEYBOARD_INTERACTIVE, and PASSWORD.

Known Hosts File

String

If provided, the client validates the server’s key against the one in the referenced file. If the server key doesn’t match the one in the file, the connection will be aborted.

Sftp Proxy Config

If provided, a proxy will be used for the connection.

Connection Timeout

Number

A scalar value representing the amount of time to wait before a connection attempt times out. This attribute works in tandem with Connection Timeout Unit.

10

Connection Timeout Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the Connection Timeout attribute.

SECONDS

Response Timeout

Number

A scalar value representing the amount of time to wait before an SFTP request times out. This corresponds to the internal sftp-client-cmd-timeout property on the org.apache.sshd.sftp.client.impl.AbstractSftpClient AbstractSftpClient, which is applied by DefaultSftpClient when sending SFTP commands. Defaults to 30 seconds (the default of the SFTP client), but can be overridden here. This attribute works in tandem with Response Timeout Unit.

30

Response Timeout Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit that qualifies the Response Timeout Unit attribute.

SECONDS

Host

String

The SFTP server host, such as www.mulesoft.com, localhost, or 192.168.0.1, and so on.

x

Port

Number

The port number of the SFTP server to connect on.

22

Username

String

Username for the SFTP Server. Required if the server is authenticated.

Password

String

Password for the SFTP Server. Required if the server is authenticated.

Passphrase

String

The passphrase (password) for the identity file if required. This parameter is ignored if identity file is not provided.

Identity File

String

An identity file location for a PKI private key.
ssh-keygen’s OpenSSH PKI format is not accepted. You can use argument "-m PEM".

PRNG Algorithm

Enumeration is one of:

  • AUTOSELECT

  • NativePRNG

  • SHA1PRNG

  • NativePRNGBlocking

  • NativePRNGNonBlocking

The Pseudo Random Number Generator Algorithm to use.

AUTOSELECT

Security Configuration

Provides support to override security related configurations like Ciphers, MACs, Kex Algorithms, etc.

Reconnection

When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy.

Pooling Profile

Characteristics of the connection pool.

## Supported Operations - [Copy](#copy) - [Create Directory](#createDirectory) - [Delete](#delete) - [List](#list) - [Move](#move) - [Read](#read) - [Rename](#rename) - [Write](#write) ### Associated Sources - [On New or Updated File](#listener) ## Operations ### Copy `` Copies the file or directory specified in **Source Path** into the **Target Path**. The source path can be either a file or a directory. If it points to a directory, then it is copied recursively. If the target path doesn’t exist, and neither does its parent, then a parent folder is created if **Create parent directories** is set to `true`. If **Create parent directories** is set to `false`, then an `SFTP:ILLEGAL_PATH` error is thrown. If **Overwrite** is set to `true` and the target file already exists, then the target file is overwritten. Otherwise, an `SFTP:FILE_ALREADY_EXISTS` error is thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Source Path

String

The path to the file to copy.

x

Target Path

String

The target directory for where to copy the file.

x

Create Parent Directories

Boolean

Whether or not to attempt to create parent directories if they don’t exist.

true

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Rename To

String

Rename the copied file. If this value is not provided, the original file name is kept.

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Create Directory `` Creates a new directory using the value in the **Directory Path** field. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory Path

String

The new directory’s name.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Delete `` Deletes the file that the path field points to, provided that the file is not locked. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path to the file to delete.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:CONNECTIVITY ### List `` Lists all the files in the **Directory Path** depending on the rules in the File Matching Rules field. If the listing encounters a directory, the output list will include its contents, depending on the value of the **Recursive** field. If **Recursive** is set to the `true` value, but a found directory is rejected by the rules in the **File Matching Rules** field, then recursion does not occur in the directory. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory Path

String

The directory path to list.

x

Recursive

Boolean

Whether to include the contents of subdirectories. Defaults to false.

false

File Matching Rules

A matcher used to filter the output list.

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit to use in the wait time between size checks.

Target Variable

String

The name of a variable to store the operation’s output.

Target Value

String

An expression to evaluate against the operation’s output and store the expression outcome in the target variable.

#[payload]

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### Output

Type

Array of Message of [String] payload and [SFTP File Attributes] attributes. The payload contains the element path.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED ### Move `` Moves the file or directory from the **Source Path** into the **Target Path**. The source path can be either a file or a directory. If it points to a directory, then it will be moved recursively. If the target path doesn’t exist, and neither does its parent, then a parent folder is created if **Create parent directories** is set to `true`. If **Create parent directories** is set to `false`, then an `SFTP:ILLEGAL_PATH` error is thrown. If the target file already exists, then it will be overwritten if **Overwrite** is set to `true`. If **Overwrite** is set to `false`, an `SFTP:FILE_ALREADY_EXISTS` error will be thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Source Path

String

The path to the file to copy.

x

Target Path

String

The target directory.

x

Create Parent Directories

Boolean

Whether or not to attempt to create any parent directories that don’t exist.

true

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Rename To

String

Name of the moved file. If a value is not provided, the original file name is kept.

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### For Configurations. - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Read `` Obtains the content and metadata of a file at a given path. The operation itself returns a message whose payload is an input stream with the file’s content, and the metadata is represented as an `SftpFileAttributes` object that’s placed as the message `Message#getAttributes()` attributes. If the lock parameter is set to `true`, then a file system level lock is placed on the file until the input stream this operation returns is closed or fully consumed. Because the lock is provided by the host file system, its behavior might change depending on the SFTP server or its file system. Take that into consideration before relying on this lock. This method also makes a best effort to determine the MIME type of the file being read by using the file’s extension to make an educated guess. You can also use the output **Encoding** and output **MIME Type** optional parameters to force the encoding and MIME type. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

File Path

String

The path to the file to read.

x

Lock

Boolean

Whether or not to lock the file. Defaults to false.

false

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit to use in the wait time between size checks.

Output Mime Type

String

The MIME type of the payload that this operation outputs.

Output Encoding

String

The encoding of the payload that this operation outputs.

Streaming Strategy

Configure whether to use repeatable streams.

Target Variable

String

The name of a variable to store the operation’s output.

Target Value

String

An expression to evaluate against the operation’s output and store the expression outcome in the target variable.

#[payload]

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### Output

Type

Binary

Attributes Type

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:FILE\_LOCK - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:CONNECTIVITY ### Rename `` Renames the file to which the path points to the value provided in the **New Name** parameter. This argument should not contain any path separator, or an `SFTP:ILLEGAL_PATH` error will be thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path to the file to rename.

x

New Name

String

The file’s new name.

x

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Write `` Writes the content into the file the path points to. If the directory to which the file is attempting to be written doesn’t exist, then the operation will either throw an `SFTP:ILLEGAL_PATH` error, or create a new folder, depending on the value of **Create parent directories**. If the file already exists, then the behavior depends on the supplied mode. This operation also supports locking depending on the value of the lock argument, and follows the same rules and considerations as described in the read operation. > [!NOTE] An additional check is performed if the file already exists, thus the FTP `STAT` command > is executed before writing the file. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path of the file to write.

x

Content

Binary

The content to write into the file. Defaults to the current Message payload.

#[payload]

Create Parent Directories

Boolean

Whether or not to attempt to create any parent directories that don’t exist.

true

Lock

Boolean

Whether or not to lock the file. Defaults to false.

false

Write Mode

Enumeration is one of:

  • OVERWRITE

  • APPEND

  • CUSTOM_APPEND

  • CREATE_NEW

A FileWriteMode.

  • OVERWRITE

    If the file to be written exists, then overwrite it.

  • APPEND

    If the file to be written exists, then append the content to that file.

  • CUSTOM_APPEND

    If the file to be written using the CUSTOM write strategy exists, then append the content to that file.

  • CREATE_NEW

    Create a file and raise an error if the file exists.

OVERWRITE

Write Strategy

Enumeration, one of:

  • STANDARD

  • CUSTOM

Strategy to write the file.

  • STANDARD

    The standard write function is used where the file write mode is honored.

  • CUSTOM

    A custom write function is used to write to files where offset is manually calculated.

STANDARD

Buffer Size For Write Strategy

Enumeration, one of:

  • BUFFER_SIZE_1KB

  • BUFFER_SIZE_2KB

  • BUFFER_SIZE_4KB

  • BUFFER_SIZE_8KB

  • BUFFER_SIZE_16KB

Buffer size for the custom write.

BUFFER_SIZE_8KB

Config Ref

ConfigurationProvider

Configuration name to execute the write strategy.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:FILE\_LOCK - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:ILLEGAL\_CONTENT - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY - SFTP:FILE\_DOESNT\_EXIST ## Sources ### On New or Updated File `` Polls a directory and looks for files that have been created in it. One message is generated for each file that is found. The key part of this functionality is how to determine that a file is actually new. There are three strategies for that: - Set the **Auto delete** parameter to `true` to delete each file after it is processed, which causes all files obtained in the next poll to be necessarily new. - Set the **Move to directory** parameter to move each file to a different directory after it is processed, which achieves the same effect as **Auto delete** but without losing the file. - Use **Watermark enabled** to pick only files that have been created or updated after the last poll was executed. You can also use a matcher for additional filtering of files. The **On New Or Updated File** source ignores files that return with an empty attributes list. The list can be empty if the modification time (MDTM) is not enabled by the SFTP server or if the server returns an error when listing the attributes. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory

String

The directory in which polled files are contained.

Recursive

Boolean

Whether or not to also poll files contained in sub directories.

true

Matcher

A matcher used to filter events on files that do not meet the file matching criteria.

Watermark Enabled

Boolean

Controls whether or not to do watermarking, and if so, if the watermark should consider the file’s modification or creation timestamps. Enable this field to have the connector pick only files that were created or updated after the completion of the latest poll.

false

Time Between Size Check

Number

Wait time (in milliseconds) between size checks to determine if a file is ready to read. This allows a file write to complete before processing. When enabled, Mule performs two size checks, waiting the specified time between calls. If both checks return the same value, the file is ready to read.
You can disable this feature by omitting a value.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit which qualifies the Time between size check attribute.

Output Mime Type

String

The MIME type of the payload that this operation outputs.

Output Encoding

String

The encoding of the payload that this operation outputs.

Primary Node Only

Boolean

Whether this source should be executed only on the primary node when running in a cluster.

Scheduling Strategy

scheduling-strategy

Configures the scheduler that triggers the polling.

x

Streaming Strategy

Configure whether to use repeatable streams.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

A retry strategy in case of connectivity errors. The source stops polling if the Reconnect strategy fails. Use the Reconnect Forever strategy to run the source indefinitely.

Auto Delete

Boolean

Whether to delete each file after processing.

false

Move To Directory

String

If provided, each processed file will be moved to a directory that is pointed to by this path.

Rename To

String

This parameter works in tandem with Move to directory. Use this parameter to enter the name of the directory under which to move the file. Do not set this parameter if Move to directory hasn’t also been set.

Apply Post Action When Failed

Boolean

Specifies whether any of the post actions (Auto delete and Move to directory) should also be applied in case the file fails to be processed. If set to false, no failed files will be moved or deleted.

true

Overwrite

Boolean

Enables you to overwrite the target file when the destination file has the same name.

false

#### Output

Type

Binary

Attributes Type

### For Configurations - [Default Configuration](#config) ## Types ### SFTP Proxy Config
FieldTypeDescriptionDefault ValueRequired

Host

String

x

Port

Number

x

Username

String

Password

String

Protocol

Enumeration is of:

  • HTTP

  • SOCKS5

x

### Security Configuration Configuring security settings using the SSH Config Override File means you accept the [shared responsibilities](https://docs.mulesoft.com/connectors/introduction/connectors-shared-responsibilities) documentation.
FieldTypeDescriptionDefault ValueRequired

SSH Config Override File

String

Path to the file with the SSH override configurations. It supports the following configs:

  • KexAlgorithms
    Specifies the comma separated list of key exchange algorithms.

  • Ciphers
    Specifies the comma separated list of symmetric ciphers.

  • HostKeyAlgorithms
    Specifies the comma separated list of host key signature algorithms.

  • MACs
    Specifies the comma separated list of message authentication codes.

You define the keys in the file you need to override, defaults are taken for the remaining keys.

### Reconnection
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy.

Reconnection Strategy

The reconnection strategy to use. It overrides the Fails Deployment field. So if the reconnection strategy is set to reconnect-forever, the deployment never fails.

### Reconnect
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often (in milliseconds) to reconnect.

Count

Number

How many reconnection attempts to make.

blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

true

### Reconnect Forever
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often (in milliseconds) to reconnect.

blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

true

### Pooling Profile
FieldTypeDescriptionDefault ValueRequired

Max Active

Number

Controls the maximum number of connections that can be active at one time. When set to a negative value, there is no limit to the number of components that can be active at one time. When Max active is exceeded, the pool is exhausted.

5

Max Idle

Number

Controls the maximum number of connections that can sit idle in the pool at any one time. When set to a negative value, there is no limit to the number of connections that can be idle at one time.

5

Max Wait

Number

Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the Exhausted action is set to WHEN_EXHAUSTED_WAIT.

5

Min Eviction Millis

Number

Determines the minimum amount of time an object can sit idle in the pool before it is eligible for eviction. When non-positive, no objects will be evicted from the pool due to idle time alone.

1800000

Eviction Check Interval Millis

Number

Specifies the number of milliseconds between runs of the object evictor. When non-positive, no object evictor is executed.

-1

Exhausted Action

Enumeration is one of:

  • WHEN_EXHAUSTED_GROW

  • WHEN_EXHAUSTED_WAIT

  • WHEN_EXHAUSTED_FAIL

Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are:

  • WHEN_EXHAUSTED_FAIL, which will throw a NoSuchElementException. * WHEN_EXHAUSTED_WAIT, which will block by invoking Object.wait(long) until a new or idle object is available.

  • WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for, at most, the specified number of milliseconds, after which a NoSuchElementException will be thrown. If maxThreadWait is a negative value, it will block indefinitely.

WHEN_EXHAUSTED_GROW

Initialisation Policy

Enumeration is one of:

  • INITIALISE_NONE

  • INITIALISE_ONE

  • INITIALISE_ALL

Determines how components in a pool should be initialized. The possible values are:

  • INITIALISE_NONE, which means no components will be loaded into the pool at startup.

  • INITIALISE_ONE, which will load one initial component into the pool at startup.

  • INITIALISE_ALL, which will load all components in the pool at startup.

INITIALISE_NONE

### Expiration Policy
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it’s considered eligible for expiration.

Time Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the Max idle time attribute.

### SFTP File Attributes
FieldTypeDescriptionDefault ValueRequired

Timestamp

DateTime

x

Size

Number

x

Regular File

Boolean

false

Directory

Boolean

false

Symbolic Link

Boolean

false

Permissions

Number

x

Path

String

x

File Name

String

x

### Matcher
FieldTypeDescriptionDefault ValueRequired

Timestamp Since

DateTime

Files created before this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead.

Timestamp Until

DateTime

Files created after this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead.

Not Updated In The Last

Number

Minimum time that should pass since a file was last updated to not be rejected. This attribute works in tandem with Time unit.

Updated In The Last

Number

Maximum time that should pass from when a file was last updated to not be rejected. This attribute works in tandem with Time unit.

Time Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A Not updated in the last attributes.

MILLISECONDS

Case Sensitive

Boolean

Enables you to configure an external file system matcher as case sensitive or insensitive.

true

Filename Pattern

String

A matching pattern to apply on the file name. Supports glob expressions (default) and regex expressions. To use any of the expressions set a prefix, for example, glob:*.{java, js} or regex:[0-9]test.csv.

Path Pattern

String

A matching pattern to apply on the file path

Directories

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a directory

INCLUDE

Regular Files

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a regular file

INCLUDE

Sym Links

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a symbolic link

INCLUDE

Min Size

Number

The minimum file size in bytes. Files smaller than the specified value are rejected.

Max Size

Number

The maximum file size in bytes. Files larger than the specified value are rejected.

### Repeatable In Memory Stream
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

This is the amount of memory to allocate to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then it will be expanded according to the Buffer size increment attribute, with an upper limit of Max in memory size.

Buffer Size Increment

Number

This is by how much the buffer size will be expanded if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, and that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full.

Max Buffer Size

Number

This is the maximum amount of memory to use. If more than the specified maximum is used, then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit.

Buffer Unit

Enumeration is one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which all these attributes are expressed.

### Repeatable File Store Stream
FieldTypeDescriptionDefault ValueRequired

Max In Memory Size

Number

Defines the maximum memory that the stream should use to keep data in memory. If more than that is consumed then content is buffered on the disk.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which maxInMemorySize is expressed

### Redelivery Policy
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

The maximum number of times a message can be redelivered and processed unsuccessfully before triggering process-failed-message

Use Secure Hash

Boolean

Whether to use a secure hash algorithm to identify a redelivered message

Message Digest Algorithm

String

The secure hashing algorithm to use. If not set, the default is SHA-256.

Id Expression

String

Defines one or more expressions to use to determine when a message has been redelivered. This property may only be set if useSecureHash is false.

Object Store

ObjectStore

The object store where the redelivery counter for each message will be stored.

### Repeatable In Memory Iterable
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

This is the number of instances initially allowed to be kept in memory in order to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then it will be expanded according to the Buffer size increment attribute, with an upper limit of Max in memory size. Default value is 100 instances.

Buffer Size Increment

Number

How much the buffer size will expand if it exceeds its initial specified size. Setting a value of zero or lower means that the buffer should not expand, and that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full. Default value is 100 instances.

Max in Memory Instances

Number

This is the maximum amount of memory to use. If more than the maximum amount is used, then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit.

### Repeatable File Store Iterable
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

The maximum number of instances to keep in memory. If more than the maximum is required, content starts to buffer to the disk.

## See Also [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # SFTP Connector 2.6 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) manages secure file transfers over the Secure File Transfer Protocol (SFTP). You can read files, list directories, create folders, copy, move, rename, and delete files on SFTP servers with built-in file locking and matching capabilities. The connector provides the same operations and behavior as File Connector and FTP Connector for consistent integration patterns. ## Representation of File Attributes Mule 4 provides a message structure of a payload and attributes in which the data moves around, making that payload a file content. The attributes provide an object that contains metadata on the payload and information such as the file’s name, path, size, and timestamps. For FTP Connector and SFTP Connector, these attributes are known as _file attributes_. The Mule message contains the concepts of encoding and MIME type. These describe the format in which a payload is represented. The file attributes describe a file’s encoding and MIME type. ## Before You Begin To use this connector, you must be familiar with: - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have access to Anypoint Platform and Anypoint Studio. ## Next Step After you complete the prerequisites, you are ready to create your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/sftp-connector/2.6/sftp-studio). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # SFTP Connector 2.6 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) enables secure and reliable access to files and directories on SFTP servers. It facilitates secure file transfers between your Mule applications and remote SFTP locations, supporting a variety of file operations such as reading, writing, and managing files and folders. Release Notes: [SFTP Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/connector-sftp) > [!NOTE] PPK (Private Key) file does not support identity file for SFTP Connector. ## Configurations --- ### Default Configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

Connection

The connection types to provide to this configuration.

x

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read. This allows a file write to complete before processing. If no value is provided, the check will not be performed. When enabled, Mule waits the specified time between calls and performs two size checks. If both checks return the same value, the file is ready to read. This attribute works in tandem with Time Between Size Check Unit.

Time Between Size Check Unit

Enumeration, is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit that qualifies the Time Between Size Check attribute.

MILLISECONDS

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform will expire the instance at the exact moment that it becomes eligible. Mule runtime engine purges the instances when it sees it fit.

#### Connection Types ##### SFTP Connection A file system provider that provides instances of SFTP file system from instances of SFTP Connector. ###### Parameters
NameTypeDescriptionDefault ValueRequired

Working Directory

String

The directory designated as the root of every relative path used with this connector. If not provided, it defaults to the remote server default. Define a working directory because some SFTP servers do not return output for the present working directory command. While the behavior of the SFTP server side cannot be controlled, setting this value mitigates such scenario.

Preferred Authentication Methods

Array of enumeration is one of:

  • GSSAPI_WITH_MIC

  • PUBLIC_KEY

  • KEYBOARD_INTERACTIVE

  • PASSWORD

Set of authentication methods used by the SFTP client. Valid values are: GSSAPI_WITH_MIC, PUBLIC_KEY, KEYBOARD_INTERACTIVE, and PASSWORD.

Known Hosts File

String

If provided, the client validates the server’s key against the one in the referenced file. If the server key doesn’t match the one in the file, the connection will be aborted.

Sftp Proxy Config

If provided, a proxy will be used for the connection.

Connection Timeout

Number

A scalar value representing the amount of time to wait before a connection attempt times out. This attribute works in tandem with Connection Timeout Unit.

10

Connection Timeout Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the Connection Timeout attribute.

SECONDS

Response Timeout

Number

A scalar value representing the amount of time to wait before an SFTP request times out. This corresponds to the internal sftp-client-cmd-timeout property on the org.apache.sshd.sftp.client.impl.AbstractSftpClient AbstractSftpClient, which is applied by DefaultSftpClient when sending SFTP commands. Defaults to 30 seconds (the default of the SFTP client), but can be overridden here. This attribute works in tandem with Response Timeout Unit.

30

Response Timeout Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit that qualifies the Response Timeout Unit attribute.

SECONDS

Host

String

The SFTP server host, such as www.mulesoft.com, localhost, or 192.168.0.1, and so on.

x

Port

Number

The port number of the SFTP server to connect on.

22

Username

String

Username for the SFTP Server. Required if the server is authenticated.

Password

String

Password for the SFTP Server. Required if the server is authenticated.

Passphrase

String

The passphrase (password) for the identity file if required. This parameter is ignored if identity file is not provided.

Identity File

String

An identity file location for a PKI private key.
ssh-keygen’s OpenSSH PKI format is not accepted. You can use argument "-m PEM".

PRNG Algorithm

Enumeration is one of:

  • AUTOSELECT

  • NativePRNG

  • SHA1PRNG

  • NativePRNGBlocking

  • NativePRNGNonBlocking

The Pseudo Random Number Generator Algorithm to use.

AUTOSELECT

Security Configuration

Provides support to override security related configurations like Ciphers, MACs, Kex Algorithms, etc.

Reconnection

When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy.

Pooling Profile

Characteristics of the connection pool.

## Supported Operations - [Copy](#copy) - [Create Directory](#createDirectory) - [Delete](#delete) - [List](#list) - [Move](#move) - [Read](#read) - [Rename](#rename) - [Write](#write) ### Associated Sources - [On New or Updated File](#listener) ## Operations ### Copy `` Copies the file or directory specified in **Source Path** into the **Target Path**. The source path can be either a file or a directory. If it points to a directory, then it is copied recursively. If the target path doesn’t exist, and neither does its parent, then a parent folder is created if **Create parent directories** is set to `true`. If **Create parent directories** is set to `false`, then an `SFTP:ILLEGAL_PATH` error is thrown. If **Overwrite** is set to `true` and the target file already exists, then the target file is overwritten. Otherwise, an `SFTP:FILE_ALREADY_EXISTS` error is thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Source Path

String

The path to the file to copy.

x

Target Path

String

The target directory for where to copy the file.

x

Create Parent Directories

Boolean

Whether or not to attempt to create parent directories if they don’t exist.

true

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Rename To

String

Rename the copied file. If this value is not provided, the original file name is kept.

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Create Directory `` Creates a new directory using the value in the **Directory Path** field. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory Path

String

The new directory’s name.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Delete `` Deletes the file that the path field points to, provided that the file is not locked. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path to the file to delete.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:CONNECTIVITY ### List `` Lists all the files in the **Directory Path** depending on the rules in the File Matching Rules field. If the listing encounters a directory, the output list will include its contents, depending on the value of the **Recursive** field. If **Recursive** is set to the `true` value, but a found directory is rejected by the rules in the **File Matching Rules** field, then recursion does not occur in the directory. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory Path

String

The directory path to list.

x

Recursive

Boolean

Whether to include the contents of subdirectories. Defaults to false.

false

File Matching Rules

A matcher used to filter the output list.

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit to use in the wait time between size checks.

Target Variable

String

The name of a variable to store the operation’s output.

Target Value

String

An expression to evaluate against the operation’s output and store the expression outcome in the target variable.

#[payload]

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### Output

Type

Array of Message of [String] payload and [SFTP File Attributes] attributes. The payload contains the element path.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED ### Move `` Moves the file or directory from the **Source Path** into the **Target Path**. The source path can be either a file or a directory. If it points to a directory, then it will be moved recursively. If the target path doesn’t exist, and neither does its parent, then a parent folder is created if **Create parent directories** is set to `true`. If **Create parent directories** is set to `false`, then an `SFTP:ILLEGAL_PATH` error is thrown. If the target file already exists, then it will be overwritten if **Overwrite** is set to `true`. If **Overwrite** is set to `false`, an `SFTP:FILE_ALREADY_EXISTS` error will be thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Source Path

String

The path to the file to copy.

x

Target Path

String

The target directory.

x

Create Parent Directories

Boolean

Whether or not to attempt to create any parent directories that don’t exist.

true

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Rename To

String

Name of the moved file. If a value is not provided, the original file name is kept.

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### For Configurations. - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Read `` Obtains the content and metadata of a file at a given path. The operation itself returns a message whose payload is an input stream with the file’s content, and the metadata is represented as an `SftpFileAttributes` object that’s placed as the message `Message#getAttributes()` attributes. If the lock parameter is set to `true`, then a file system level lock is placed on the file until the input stream this operation returns is closed or fully consumed. Because the lock is provided by the host file system, its behavior might change depending on the SFTP server or its file system. Take that into consideration before relying on this lock. This method also makes a best effort to determine the MIME type of the file being read by using the file’s extension to make an educated guess. You can also use the output **Encoding** and output **MIME Type** optional parameters to force the encoding and MIME type. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

File Path

String

The path to the file to read.

x

Lock

Boolean

Whether or not to lock the file. Defaults to false.

false

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit to use in the wait time between size checks.

Output Mime Type

String

The MIME type of the payload that this operation outputs.

Output Encoding

String

The encoding of the payload that this operation outputs.

Streaming Strategy

Configure whether to use repeatable streams.

Target Variable

String

The name of a variable to store the operation’s output.

Target Value

String

An expression to evaluate against the operation’s output and store the expression outcome in the target variable.

#[payload]

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### Output

Type

Binary

Attributes Type

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:FILE\_LOCK - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:CONNECTIVITY ### Rename `` Renames the file to which the path points to the value provided in the **New Name** parameter. This argument should not contain any path separator, or an `SFTP:ILLEGAL_PATH` error will be thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path to the file to rename.

x

New Name

String

The file’s new name.

x

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Write `` Writes the content into the file the path points to. If the directory to which the file is attempting to be written doesn’t exist, then the operation will either throw an `SFTP:ILLEGAL_PATH` error, or create a new folder, depending on the value of **Create parent directories**. If the file already exists, then the behavior depends on the supplied mode. This operation also supports locking depending on the value of the lock argument, and follows the same rules and considerations as described in the read operation. > [!NOTE] An additional check is performed if the file already exists, thus the FTP `STAT` command > is executed before writing the file. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path of the file to write.

x

Content

Binary

The content to write into the file. Defaults to the current Message payload.

#[payload]

Create Parent Directories

Boolean

Whether or not to attempt to create any parent directories that don’t exist.

true

Lock

Boolean

Whether or not to lock the file. Defaults to false.

false

Write Mode

Enumeration is one of:

  • OVERWRITE

  • APPEND

  • CUSTOM_APPEND

  • CREATE_NEW

A FileWriteMode.

  • OVERWRITE

    If the file to be written exists, then overwrite it.

  • APPEND

    If the file to be written exists, then append the content to that file.

  • CUSTOM_APPEND

    If the file to be written using the CUSTOM write strategy exists, then append the content to that file.

  • CREATE_NEW

    Create a file and raise an error if the file exists.

OVERWRITE

Write Strategy

Enumeration, one of:

  • STANDARD

  • CUSTOM

Strategy to write the file.

  • STANDARD

    The standard write function is used where the file write mode is honored.

  • CUSTOM

    A custom write function is used to write to files where offset is manually calculated.

STANDARD

Buffer Size For Write Strategy

Enumeration, one of:

  • BUFFER_SIZE_1KB

  • BUFFER_SIZE_2KB

  • BUFFER_SIZE_4KB

  • BUFFER_SIZE_8KB

  • BUFFER_SIZE_16KB

Buffer size for the custom write.

BUFFER_SIZE_8KB

Config Ref

ConfigurationProvider

Configuration name to execute the write strategy.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

> [!NOTE] If your SFTP server is a legacy system that doesn’t support the `SSH_FXF_APPEND` flag, set > **Write Strategy** to `CUSTOM` and **Write Mode** to `CUSTOM_APPEND` to prevent files from being > overwritten. For more information, refer to > [Standard Append Mode Overwrites or Fails](https://docs.mulesoft.com/sftp-connector/2.6/sftp-connector-troubleshooting#standard-append-mode-overwrites-or-fails). ### For Configurations - [Default Configuration](#config) #### Throws - SFTP:FILE\_LOCK - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:ILLEGAL\_CONTENT - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY - SFTP:FILE\_DOESNT\_EXIST ## Sources ### On New or Updated File `` Polls a directory and looks for files that have been created in it. One message is generated for each file that is found. The key part of this functionality is how to determine that a file is actually new. There are three strategies for that: - Set the **Auto delete** parameter to `true` to delete each file after it is processed, which causes all files obtained in the next poll to be necessarily new. - Set the **Move to directory** parameter to move each file to a different directory after it is processed, which achieves the same effect as **Auto delete** but without losing the file. - Use **Watermark enabled** to pick only files that have been created or updated after the last poll was executed. You can also use a matcher for additional filtering of files. The **On New Or Updated File** source ignores files that return with an empty attributes list. The list can be empty if the modification time (MDTM) is not enabled by the SFTP server or if the server returns an error when listing the attributes. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory

String

The directory in which polled files are contained.

Recursive

Boolean

Whether or not to also poll files contained in sub directories.

true

Matcher

A matcher used to filter events on files that do not meet the file matching criteria.

Watermark Enabled

Boolean

Controls whether or not to do watermarking, and if so, if the watermark should consider the file’s modification or creation timestamps. Enable this field to have the connector pick only files that were created or updated after the completion of the latest poll.

false

Time Between Size Check

Number

Wait time (in milliseconds) between size checks to determine if a file is ready to read. This allows a file write to complete before processing. When enabled, Mule performs two size checks, waiting the specified time between calls. If both checks return the same value, the file is ready to read.
You can disable this feature by omitting a value.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit which qualifies the Time between size check attribute.

Output Mime Type

String

The MIME type of the payload that this operation outputs.

Output Encoding

String

The encoding of the payload that this operation outputs.

Primary Node Only

Boolean

Whether this source should be executed only on the primary node when running in a cluster.

Scheduling Strategy

scheduling-strategy

Configures the scheduler that triggers the polling.

x

Streaming Strategy

Configure whether to use repeatable streams.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

A retry strategy in case of connectivity errors. The source stops polling if the Reconnect strategy fails. Use the Reconnect Forever strategy to run the source indefinitely.

Auto Delete

Boolean

Whether to delete each file after processing.

false

Move To Directory

String

If provided, each processed file will be moved to a directory that is pointed to by this path.

Rename To

String

This parameter works in tandem with Move to directory. Use this parameter to enter the name of the directory under which to move the file. Do not set this parameter if Move to directory hasn’t also been set.

Apply Post Action When Failed

Boolean

Specifies whether any of the post actions (Auto delete and Move to directory) should also be applied in case the file fails to be processed. If set to false, no failed files will be moved or deleted.

true

Overwrite

Boolean

Enables you to overwrite the target file when the destination file has the same name.

false

#### Output

Type

Binary

Attributes Type

### For Configurations - [Default Configuration](#config) ## Types ### SFTP Proxy Config
FieldTypeDescriptionDefault ValueRequired

Host

String

x

Port

Number

x

Username

String

Password

String

Protocol

Enumeration is of:

  • HTTP

  • SOCKS5

x

### Security Configuration Configuring security settings using the SSH Config Override File means you accept the [shared responsibilities](https://docs.mulesoft.com/connectors/introduction/connectors-shared-responsibilities) documentation.
FieldTypeDescriptionDefault ValueRequired

SSH Config Override File

String

Path to the file with the SSH override configurations. It supports the following configs:

  • KexAlgorithms
    Specifies the comma separated list of key exchange algorithms.

  • Ciphers
    Specifies the comma separated list of symmetric ciphers.

  • HostKeyAlgorithms
    Specifies the comma separated list of host key signature algorithms.

  • MACs
    Specifies the comma separated list of message authentication codes.

You define the keys in the file you need to override, defaults are taken for the remaining keys.

### Reconnection
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy.

Reconnection Strategy

The reconnection strategy to use. It overrides the Fails Deployment field. So if the reconnection strategy is set to reconnect-forever, the deployment never fails.

### Reconnect
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often (in milliseconds) to reconnect.

Count

Number

How many reconnection attempts to make.

blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

true

### Reconnect Forever
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often (in milliseconds) to reconnect.

blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

true

### Pooling Profile
FieldTypeDescriptionDefault ValueRequired

Max Active

Number

Controls the maximum number of connections that can be active at one time. When set to a negative value, there is no limit to the number of components that can be active at one time. When Max active is exceeded, the pool is exhausted.

5

Max Idle

Number

Controls the maximum number of connections that can sit idle in the pool at any one time. When set to a negative value, there is no limit to the number of connections that can be idle at one time.

5

Max Wait

Number

Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the Exhausted action is set to WHEN_EXHAUSTED_WAIT.

5

Min Eviction Millis

Number

Determines the minimum amount of time an object can sit idle in the pool before it is eligible for eviction. When non-positive, no objects will be evicted from the pool due to idle time alone.

1800000

Eviction Check Interval Millis

Number

Specifies the number of milliseconds between runs of the object evictor. When non-positive, no object evictor is executed.

-1

Exhausted Action

Enumeration is one of:

  • WHEN_EXHAUSTED_GROW

  • WHEN_EXHAUSTED_WAIT

  • WHEN_EXHAUSTED_FAIL

Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are:

  • WHEN_EXHAUSTED_FAIL, which will throw a NoSuchElementException. * WHEN_EXHAUSTED_WAIT, which will block by invoking Object.wait(long) until a new or idle object is available.

  • WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for, at most, the specified number of milliseconds, after which a NoSuchElementException will be thrown. If maxThreadWait is a negative value, it will block indefinitely.

WHEN_EXHAUSTED_GROW

Initialisation Policy

Enumeration is one of:

  • INITIALISE_NONE

  • INITIALISE_ONE

  • INITIALISE_ALL

Determines how components in a pool should be initialized. The possible values are:

  • INITIALISE_NONE, which means no components will be loaded into the pool at startup.

  • INITIALISE_ONE, which will load one initial component into the pool at startup.

  • INITIALISE_ALL, which will load all components in the pool at startup.

INITIALISE_NONE

### Expiration Policy
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it’s considered eligible for expiration.

Time Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the Max idle time attribute.

### SFTP File Attributes
FieldTypeDescriptionDefault ValueRequired

Timestamp

DateTime

x

Size

Number

x

Regular File

Boolean

false

Directory

Boolean

false

Symbolic Link

Boolean

false

Permissions

Number

x

Path

String

x

File Name

String

x

### Matcher
FieldTypeDescriptionDefault ValueRequired

Timestamp Since

DateTime

Files created before this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead.

Timestamp Until

DateTime

Files created after this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead.

Not Updated In The Last

Number

Minimum time that should pass since a file was last updated to not be rejected. This attribute works in tandem with Time unit.

Updated In The Last

Number

Maximum time that should pass from when a file was last updated to not be rejected. This attribute works in tandem with Time unit.

Time Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A Not updated in the last attributes.

MILLISECONDS

Case Sensitive

Boolean

Enables you to configure an external file system matcher as case sensitive or insensitive.

true

Filename Pattern

String

A matching pattern to apply on the file name. Supports glob expressions (default) and regex expressions. To use any of the expressions set a prefix, for example, glob:*.{java, js} or regex:[0-9]test.csv.

Path Pattern

String

A matching pattern to apply on the file path

Directories

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a directory

INCLUDE

Regular Files

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a regular file

INCLUDE

Sym Links

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a symbolic link

INCLUDE

Min Size

Number

The minimum file size in bytes. Files smaller than the specified value are rejected.

Max Size

Number

The maximum file size in bytes. Files larger than the specified value are rejected.

### Repeatable In Memory Stream
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

This is the amount of memory to allocate to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then it will be expanded according to the Buffer size increment attribute, with an upper limit of Max in memory size.

Buffer Size Increment

Number

This is by how much the buffer size will be expanded if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, and that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full.

Max Buffer Size

Number

This is the maximum amount of memory to use. If more than the specified maximum is used, then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit.

Buffer Unit

Enumeration is one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which all these attributes are expressed.

### Repeatable File Store Stream
FieldTypeDescriptionDefault ValueRequired

Max In Memory Size

Number

Defines the maximum memory that the stream should use to keep data in memory. If more than that is consumed then content is buffered on the disk.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which maxInMemorySize is expressed

### Redelivery Policy
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

The maximum number of times a message can be redelivered and processed unsuccessfully before triggering process-failed-message

Use Secure Hash

Boolean

Whether to use a secure hash algorithm to identify a redelivered message

Message Digest Algorithm

String

The secure hashing algorithm to use. If not set, the default is SHA-256.

Id Expression

String

Defines one or more expressions to use to determine when a message has been redelivered. This property may only be set if useSecureHash is false.

Object Store

ObjectStore

The object store where the redelivery counter for each message will be stored.

### Repeatable In Memory Iterable
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

This is the number of instances initially allowed to be kept in memory in order to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then it will be expanded according to the Buffer size increment attribute, with an upper limit of Max in memory size. Default value is 100 instances.

Buffer Size Increment

Number

How much the buffer size will expand if it exceeds its initial specified size. Setting a value of zero or lower means that the buffer should not expand, and that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full. Default value is 100 instances.

Max in Memory Instances

Number

This is the maximum amount of memory to use. If more than the maximum amount is used, then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit.

### Repeatable File Store Iterable
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

The maximum number of instances to keep in memory. If more than the maximum is required, content starts to buffer to the disk.

## See Also [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # SFTP Connector 2.7 > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) manages secure file transfers over the Secure File Transfer Protocol (SFTP). You can read files, list directories, create folders, copy, move, rename, and delete files on SFTP servers with built-in file locking and matching capabilities. The connector provides the same operations and behavior as File Connector and FTP Connector for consistent integration patterns. ## Representation of File Attributes Mule 4 provides a message structure of a payload and attributes in which the data moves around, making that payload a file content. The attributes provide an object that contains metadata on the payload and information such as the file’s name, path, size, and timestamps. For FTP Connector and SFTP Connector, these attributes are known as _file attributes_. The Mule message contains the concepts of encoding and MIME type. These describe the format in which a payload is represented. The file attributes describe a file’s encoding and MIME type. ## Before You Begin To use this connector, you must be familiar with: - Anypoint Connectors - Mule runtime engine (Mule) - Elements and global elements in a Mule flow - Creating a Mule app using Anypoint Studio or Anypoint Code Builder Before creating an app, you must have access to Anypoint Platform and Anypoint Studio. ## Next Step After you complete the prerequisites, you are ready to create your own app and configure the connector using [Anypoint Studio](https://docs.mulesoft.com/sftp-connector/latest/sftp-studio). ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Use Exchange to Discover Connectors, Templates, and Examples](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # SFTP Connector 2.7 Reference > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) enables secure and reliable access to files and directories on SFTP servers. It facilitates secure file transfers between your Mule applications and remote SFTP locations, supporting a variety of file operations such as reading, writing, and managing files and folders. Release Notes: [SFTP Connector Release Notes](https://docs.mulesoft.com/release-notes/connector/connector-sftp) > [!NOTE] PPK (Private Key) file does not support identity file for SFTP Connector. ## Configurations --- ### Default Configuration #### Parameters
NameTypeDescriptionDefault ValueRequired

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

Connection

The connection types to provide to this configuration.

x

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read. This allows a file write to complete before processing. If no value is provided, the check will not be performed. When enabled, Mule waits the specified time between calls and performs two size checks. If both checks return the same value, the file is ready to read. This attribute works in tandem with Time Between Size Check Unit.

Time Between Size Check Unit

Enumeration, is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit that qualifies the Time Between Size Check attribute.

MILLISECONDS

Expiration Policy

Configures the minimum amount of time that a dynamic configuration instance can remain idle before the runtime considers it eligible for expiration. This does not mean that the platform will expire the instance at the exact moment that it becomes eligible. Mule runtime engine purges the instances when it sees it fit.

#### Connection Types ##### SFTP Connection A file system provider that provides instances of SFTP file system from instances of SFTP Connector. ###### Parameters
NameTypeDescriptionDefault ValueRequired

Working Directory

String

The directory designated as the root of every relative path used with this connector. If not provided, it defaults to the remote server default. Define a working directory because some SFTP servers do not return output for the present working directory command. While the behavior of the SFTP server side cannot be controlled, setting this value mitigates such scenario.

Preferred Authentication Methods

Array of enumeration is one of:

  • GSSAPI_WITH_MIC

  • PUBLIC_KEY

  • KEYBOARD_INTERACTIVE

  • PASSWORD

Set of authentication methods used by the SFTP client. Valid values are: GSSAPI_WITH_MIC, PUBLIC_KEY, KEYBOARD_INTERACTIVE, and PASSWORD.

Known Hosts File

String

If provided, the client validates the server’s key against the one in the referenced file. If the server key doesn’t match the one in the file, the connection will be aborted.

Sftp Proxy Config

If provided, a proxy will be used for the connection.

Connection Timeout

Number

A scalar value representing the amount of time to wait before a connection attempt times out. This attribute works in tandem with Connection Timeout Unit.

10

Connection Timeout Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the Connection Timeout attribute.

SECONDS

Response Timeout

Number

A scalar value representing the amount of time to wait before an SFTP request times out. This corresponds to the internal sftp-client-cmd-timeout property on the org.apache.sshd.sftp.client.impl.AbstractSftpClient AbstractSftpClient, which is applied by DefaultSftpClient when sending SFTP commands. Defaults to 30 seconds (the default of the SFTP client), but can be overridden here. For CloudHub deployments, set this value to at least 120 with Response Timeout Unit set to SECONDS. This attribute works in tandem with Response Timeout Unit.

30

Response Timeout Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit that qualifies the Response Timeout Unit attribute.

SECONDS

Idle Timeout Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the Idle Timeout attribute.

SECONDS

Idle Timeout

Number

Maximum length of time a connection can remain inactive before the SSH client library closes it. This attribute works in tandem with Idle Timeout Unit.

Host

String

The SFTP server host, such as www.mulesoft.com, localhost, or 192.168.0.1, and so on.

x

Port

Number

The port number of the SFTP server to connect on.

22

Username

String

Username for the SFTP Server. Required if the server is authenticated.

Password

String

Password for the SFTP Server. Required if the server is authenticated.

Passphrase

String

The passphrase (password) for the identity file if required. This parameter is ignored if identity file is not provided.

Identity File

String

An identity file location for a PKI private key.
ssh-keygen’s OpenSSH PKI format is not accepted. You can use argument "-m PEM".

PRNG Algorithm

Enumeration is one of:

  • AUTOSELECT

  • NativePRNG

  • SHA1PRNG

  • NativePRNGBlocking

  • NativePRNGNonBlocking

The Pseudo Random Number Generator Algorithm to use.

AUTOSELECT

Strict Kex

Boolean

When true, strict key-exchange handling is enabled by default for the SSH session and is disabled automatically when the peer does not support it.

true

Security Configuration

Provides support to override security related configurations like Ciphers, MACs, Kex Algorithms, etc.

Reconnection

When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy.

Pooling Profile

Characteristics of the connection pool.

## Supported Operations - [Copy](#copy) - [Create Directory](#createDirectory) - [Delete](#delete) - [List](#list) - [Move](#move) - [Read](#read) - [Rename](#rename) - [Write](#write) ### Associated Sources - [On New or Updated File](#listener) ## Operations ### Copy `` Copies the file or directory specified in **Source Path** into the **Target Path**. The source path can be either a file or a directory. If it points to a directory, then it is copied recursively. If the target path doesn’t exist, and neither does its parent, then a parent folder is created if **Create parent directories** is set to `true`. If **Create parent directories** is set to `false`, then an `SFTP:ILLEGAL_PATH` error is thrown. If **Overwrite** is set to `true` and the target file already exists, then the target file is overwritten. Otherwise, an `SFTP:FILE_ALREADY_EXISTS` error is thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Source Path

String

The path to the file to copy.

x

Target Path

String

The target directory for where to copy the file.

x

Create Parent Directories

Boolean

Whether or not to attempt to create parent directories if they don’t exist.

true

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Rename To

String

Rename the copied file. If this value is not provided, the original file name is kept.

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Create Directory `` Creates a new directory using the value in the **Directory Path** field. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory Path

String

The new directory’s name.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Delete `` Deletes the file that the path field points to, provided that the file is not locked. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path to the file to delete.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:CONNECTIVITY ### List `` Lists all the files in the **Directory Path** depending on the rules in the File Matching Rules field. If the listing encounters a directory, the output list will include its contents, depending on the value of the **Recursive** field. If **Recursive** is set to the `true` value, but a found directory is rejected by the rules in the **File Matching Rules** field, then recursion does not occur in the directory. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory Path

String

The directory path to list.

x

Recursive

Boolean

Whether to include the contents of subdirectories. Defaults to false.

false

File Matching Rules

A matcher used to filter the output list.

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit to use in the wait time between size checks.

Output Mime Type

String

The MIME type of the payload that this operation outputs.

Target Variable

String

The name of a variable to store the operation’s output.

Target Value

String

An expression to evaluate against the operation’s output and store the expression outcome in the target variable.

#[payload]

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### Output

Type

Array of Message of [String] payload and [SFTP File Attributes] attributes. The payload contains the element path.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:CONNECTIVITY - SFTP:RETRY\_EXHAUSTED ### Move `` Moves the file or directory from the **Source Path** into the **Target Path**. The source path can be either a file or a directory. If it points to a directory, then it will be moved recursively. If the target path doesn’t exist, and neither does its parent, then a parent folder is created if **Create parent directories** is set to `true`. If **Create parent directories** is set to `false`, then an `SFTP:ILLEGAL_PATH` error is thrown. If the target file already exists, then it will be overwritten if **Overwrite** is set to `true`. If **Overwrite** is set to `false`, an `SFTP:FILE_ALREADY_EXISTS` error will be thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Source Path

String

The path to the file to copy.

x

Target Path

String

The target directory.

x

Create Parent Directories

Boolean

Whether or not to attempt to create any parent directories that don’t exist.

true

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Rename To

String

Name of the moved file. If a value is not provided, the original file name is kept.

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### For Configurations. - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Read `` Obtains the content and metadata of a file at a given path. The operation itself returns a message whose payload is an input stream with the file’s content, and the metadata is represented as an `SftpFileAttributes` object that’s placed as the message `Message#getAttributes()` attributes. If the lock parameter is set to `true`, then a file system level lock is placed on the file until the input stream this operation returns is closed or fully consumed. Because the lock is provided by the host file system, its behavior might change depending on the SFTP server or its file system. Take that into consideration before relying on this lock. This method also makes a best effort to determine the MIME type of the file being read by using the file’s extension to make an educated guess. You can also use the output **Encoding** and output **MIME Type** optional parameters to force the encoding and MIME type. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

File Path

String

The path to the file to read.

x

Lock

Boolean

Whether or not to lock the file. Defaults to false.

false

Time Between Size Check

Number

Wait time between size checks to determine if a file is ready to read.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

Time unit to use in the wait time between size checks.

Output Mime Type

String

The MIME type of the payload that this operation outputs.

Output Encoding

String

The encoding of the payload that this operation outputs.

Streaming Strategy

Configure whether to use repeatable streams.

Target Variable

String

The name of a variable to store the operation’s output.

Target Value

String

An expression to evaluate against the operation’s output and store the expression outcome in the target variable.

#[payload]

Reconnection Strategy

A retry strategy in case of connectivity errors.

#### Output

Type

Binary

Attributes Type

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:FILE\_LOCK - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:CONNECTIVITY ### Rename `` Renames the file to which the path points to the value provided in the **New Name** parameter. This argument should not contain any path separator, or an `SFTP:ILLEGAL_PATH` error will be thrown. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path to the file to rename.

x

New Name

String

The file’s new name.

x

Overwrite

Boolean

Whether or not to overwrite the file if the target destination already exists.

false

Reconnection Strategy

A retry strategy in case of connectivity errors.

### For Configurations - [Default Configuration](#config) #### Throws - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY ### Write `` Writes the content into the file the path points to. If the directory to which the file is attempting to be written doesn’t exist, then the operation will either throw an `SFTP:ILLEGAL_PATH` error, or create a new folder, depending on the value of **Create parent directories**. If the file already exists, then the behavior depends on the supplied mode. This operation also supports locking depending on the value of the lock argument, and follows the same rules and considerations as described in the read operation. > [!NOTE] An additional check is performed if the file already exists, thus the FTP `STAT` command > is executed before writing the file. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Path

String

The path of the file to write.

x

Content

Binary

The content to write into the file. Defaults to the current Message payload.

#[payload]

Create Parent Directories

Boolean

Whether or not to attempt to create any parent directories that don’t exist.

true

Lock

Boolean

Whether or not to lock the file. Defaults to false.

false

Write Mode

Enumeration is one of:

  • OVERWRITE

  • APPEND

  • CUSTOM_APPEND

  • CREATE_NEW

A FileWriteMode.

  • OVERWRITE

    If the file to be written exists, then overwrite it.

  • APPEND

    If the file to be written exists, then append the content to that file.

  • CUSTOM_APPEND

    If the file to be written using the CUSTOM write strategy exists, then append the content to that file.

  • CREATE_NEW

    Create a file and raise an error if the file exists.

OVERWRITE

Write Strategy

Enumeration, one of:

  • STANDARD

  • CUSTOM

Strategy to write the file.

  • STANDARD

    The standard write function is used where the file write mode is honored.

  • CUSTOM

    A custom write function is used to write to files where offset is manually calculated.

STANDARD

Buffer Size For Write Strategy

Enumeration, one of:

  • BUFFER_SIZE_1KB

  • BUFFER_SIZE_2KB

  • BUFFER_SIZE_4KB

  • BUFFER_SIZE_8KB

  • BUFFER_SIZE_16KB

Buffer size for the custom write.

BUFFER_SIZE_8KB

Config Ref

ConfigurationProvider

Configuration name to execute the write strategy.

x

Reconnection Strategy

A retry strategy in case of connectivity errors.

> [!NOTE] If your SFTP server is a legacy system that doesn’t support the `SSH_FXF_APPEND` flag, set > **Write Strategy** to `CUSTOM` and **Write Mode** to `CUSTOM_APPEND` to prevent files from being > overwritten. For more information, refer to > [Standard Append Mode Overwrites or Fails](https://docs.mulesoft.com/sftp-connector/latest/sftp-connector-troubleshooting#standard-append-mode-overwrites-or-fails). ### For Configurations - [Default Configuration](#config) #### Throws - SFTP:FILE\_LOCK - SFTP:RETRY\_EXHAUSTED - SFTP:ILLEGAL\_PATH - SFTP:ACCESS\_DENIED - SFTP:ILLEGAL\_CONTENT - SFTP:FILE\_ALREADY\_EXISTS - SFTP:CONNECTIVITY - SFTP:FILE\_DOESNT\_EXIST ## Sources ### On New or Updated File `` Polls a directory and looks for files that have been created in it. One message is generated for each file that is found. The key part of this functionality is how to determine that a file is actually new. There are three strategies for that: - Set the **Auto delete** parameter to `true` to delete each file after it is processed, which causes all files obtained in the next poll to be necessarily new. - Set the **Move to directory** parameter to move each file to a different directory after it is processed, which achieves the same effect as **Auto delete** but without losing the file. - Use **Watermark enabled** to pick only files that have been created or updated after the last poll was executed. You can also use a matcher for additional filtering of files. The **On New Or Updated File** source ignores files that return with an empty attributes list. The list can be empty if the modification time (MDTM) is not enabled by the SFTP server or if the server returns an error when listing the attributes. #### Parameters
NameTypeDescriptionDefault ValueRequired

Configuration

String

The name of the configuration to use.

x

Directory

String

The directory in which polled files are contained.

Recursive

Boolean

Whether or not to also poll files contained in sub directories.

true

Matcher

A matcher used to filter events on files that do not meet the file matching criteria.

Watermark Enabled

Boolean

Controls whether or not to do watermarking, and if so, if the watermark should consider the file’s modification or creation timestamps. Enable this field to have the connector pick only files that were created or updated after the completion of the latest poll.

false

Time Between Size Check

Number

Wait time (in milliseconds) between size checks to determine if a file is ready to read. This allows a file write to complete before processing. When enabled, Mule performs two size checks, waiting the specified time between calls. If both checks return the same value, the file is ready to read.
You can disable this feature by omitting a value.

Time Between Size Check Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A TimeUnit which qualifies the Time between size check attribute.

Output Mime Type

String

The MIME type of the payload that this operation outputs.

Output Encoding

String

The encoding of the payload that this operation outputs.

Primary Node Only

Boolean

Whether this source should be executed only on the primary node when running in a cluster.

Scheduling Strategy

scheduling-strategy

Configures the scheduler that triggers the polling.

x

Streaming Strategy

Configure whether to use repeatable streams.

Redelivery Policy

Defines a policy for processing the redelivery of the same message.

Reconnection Strategy

A retry strategy in case of connectivity errors. The source stops polling if the Reconnect strategy fails. Use the Reconnect Forever strategy to run the source indefinitely.

Auto Delete

Boolean

Whether to delete each file after processing.

false

Move To Directory

String

If provided, each processed file will be moved to a directory that is pointed to by this path.

Rename To

String

This parameter works in tandem with Move to directory. Use this parameter to enter the name of the directory under which to move the file. Do not set this parameter if Move to directory hasn’t also been set.

Apply Post Action When Failed

Boolean

Specifies whether any of the post actions (Auto delete and Move to directory) should also be applied in case the file fails to be processed. If set to false, no failed files will be moved or deleted.

true

Overwrite

Boolean

Enables you to overwrite the target file when the destination file has the same name.

false

#### Output

Type

Binary

Attributes Type

### For Configurations - [Default Configuration](#config) ## Types ### SFTP Proxy Config
FieldTypeDescriptionDefault ValueRequired

Host

String

x

Port

Number

x

Username

String

Password

String

Protocol

Enumeration is of:

  • HTTP

  • SOCKS5

x

### Security Configuration Configuring security settings using the SSH Config Override File means you accept the [shared responsibilities](https://docs.mulesoft.com/connectors/introduction/connectors-shared-responsibilities) documentation.
FieldTypeDescriptionDefault ValueRequired

SSH Config Override File

String

Path to the file with the SSH override configurations. It supports the following configs:

  • KexAlgorithms
    Specifies the comma separated list of key exchange algorithms.

  • Ciphers
    Specifies the comma separated list of symmetric ciphers.

  • HostKeyAlgorithms
    Specifies the comma separated list of host key signature algorithms.

  • MACs
    Specifies the comma separated list of message authentication codes.

You define the keys in the file you need to override, defaults are taken for the remaining keys.

### Reconnection
FieldTypeDescriptionDefault ValueRequired

Fails Deployment

Boolean

When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy.

Reconnection Strategy

The reconnection strategy to use. It overrides the Fails Deployment field. So if the reconnection strategy is set to reconnect-forever, the deployment never fails.

### Reconnect
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often (in milliseconds) to reconnect.

Count

Number

How many reconnection attempts to make.

blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

true

### Reconnect Forever
FieldTypeDescriptionDefault ValueRequired

Frequency

Number

How often (in milliseconds) to reconnect.

blocking

Boolean

If false, the reconnection strategy runs in a separate, non-blocking thread.

true

### Pooling Profile The default pooling profile doesn’t include idle eviction, which can lead to stale connections and resource exhaustion. To close connections immediately when no transfer is active, set **Max Active** and **Max Idle** to `0`, and set **Eviction Check Interval Millis** to `-1`. To actively manage and evict stale connections, set **Eviction Check Interval Millis** to a positive value, such as `30000` milliseconds.
FieldTypeDescriptionDefault ValueRequired

Max Active

Number

Controls the maximum number of connections that can be active at one time. When set to a negative value, there is no limit to the number of components that can be active at one time. When Max active is exceeded, the pool is exhausted.

5

Max Idle

Number

Controls the maximum number of connections that can sit idle in the pool at any one time. When set to a negative value, there is no limit to the number of connections that can be idle at one time.

5

Max Wait

Number

Specifies the number of milliseconds to wait for a pooled component to become available when the pool is exhausted and the Exhausted action is set to WHEN_EXHAUSTED_WAIT.

5

Min Eviction Millis

Number

Determines the minimum amount of time an object can sit idle in the pool before it is eligible for eviction. When non-positive, no objects will be evicted from the pool due to idle time alone.

1800000

Eviction Check Interval Millis

Number

Specifies the number of milliseconds between runs of the object evictor. When non-positive, no object evictor is executed.

-1

Exhausted Action

Enumeration is one of:

  • WHEN_EXHAUSTED_GROW

  • WHEN_EXHAUSTED_WAIT

  • WHEN_EXHAUSTED_FAIL

Specifies the behavior of the Mule component pool when the pool is exhausted. Possible values are:

  • WHEN_EXHAUSTED_FAIL, which will throw a NoSuchElementException. * WHEN_EXHAUSTED_WAIT, which will block by invoking Object.wait(long) until a new or idle object is available.

  • WHEN_EXHAUSTED_GROW, which will create a new Mule instance and return it, essentially making maxActive meaningless. If a positive maxWait value is supplied, it will block for, at most, the specified number of milliseconds, after which a NoSuchElementException will be thrown. If maxThreadWait is a negative value, it will block indefinitely.

WHEN_EXHAUSTED_GROW

Initialisation Policy

Enumeration is one of:

  • INITIALISE_NONE

  • INITIALISE_ONE

  • INITIALISE_ALL

Determines how components in a pool should be initialized. The possible values are:

  • INITIALISE_NONE, which means no components will be loaded into the pool at startup.

  • INITIALISE_ONE, which will load one initial component into the pool at startup.

  • INITIALISE_ALL, which will load all components in the pool at startup.

INITIALISE_NONE

Disabled

Boolean

Whether connection pooling is disabled for this configuration.

### Expiration Policy
FieldTypeDescriptionDefault ValueRequired

Max Idle Time

Number

A scalar time value for the maximum amount of time a dynamic configuration instance should be allowed to be idle before it’s considered eligible for expiration.

Time Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A time unit that qualifies the Max idle time attribute.

### SFTP File Attributes
FieldTypeDescriptionDefault ValueRequired

Timestamp

DateTime

x

Size

Number

x

Regular File

Boolean

false

Directory

Boolean

false

Symbolic Link

Boolean

false

Permissions

Number

x

Path

String

x

File Name

String

x

### Matcher
FieldTypeDescriptionDefault ValueRequired

Timestamp Since

DateTime

Files created before this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead.

Timestamp Until

DateTime

Files created after this date are rejected. Any timezone specification in this value is ignored and the Mule server’s time zone is used instead.

Not Updated In The Last

Number

Minimum time that should pass since a file was last updated to not be rejected. This attribute works in tandem with Time unit.

Updated In The Last

Number

Maximum time that should pass from when a file was last updated to not be rejected. This attribute works in tandem with Time unit.

Time Unit

Enumeration is one of:

  • NANOSECONDS

  • MICROSECONDS

  • MILLISECONDS

  • SECONDS

  • MINUTES

  • HOURS

  • DAYS

A Not updated in the last attributes.

MILLISECONDS

Case Sensitive

Boolean

Enables you to configure an external file system matcher as case sensitive or insensitive.

true

Filename Pattern

String

A matching pattern to apply on the file name. Supports glob expressions (default) and regex expressions. To use any of the expressions set a prefix, for example, glob:*.{java, js} or regex:[0-9]test.csv.

Path Pattern

String

A matching pattern to apply on the file path

Directories

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a directory

INCLUDE

Regular Files

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a regular file

INCLUDE

Sym Links

Enumeration is one of:

  • REQUIRE

  • INCLUDE

  • EXCLUDE

Match only if the file is a symbolic link

INCLUDE

Min Size

Number

The minimum file size in bytes. Files smaller than the specified value are rejected.

Max Size

Number

The maximum file size in bytes. Files larger than the specified value are rejected.

### Repeatable In Memory Stream
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

This is the amount of memory to allocate to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then it will be expanded according to the Buffer size increment attribute, with an upper limit of Max in memory size.

Buffer Size Increment

Number

This is by how much the buffer size will be expanded if it exceeds its initial size. Setting a value of zero or lower means that the buffer should not expand, and that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full.

Max Buffer Size

Number

This is the maximum amount of memory to use. If more than the specified maximum is used, then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit.

Buffer Unit

Enumeration is one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which all these attributes are expressed.

### Repeatable File Store Stream
FieldTypeDescriptionDefault ValueRequired

Max In Memory Size

Number

Defines the maximum memory that the stream should use to keep data in memory. If more than that is consumed then content is buffered on the disk.

Buffer Unit

Enumeration, one of:

  • BYTE

  • KB

  • MB

  • GB

The unit in which maxInMemorySize is expressed

### Redelivery Policy
FieldTypeDescriptionDefault ValueRequired

Max Redelivery Count

Number

The maximum number of times a message can be redelivered and processed unsuccessfully before triggering process-failed-message

Message Digest Algorithm

String

The secure hashing algorithm to use. If not set, the default is SHA-256.

Message Identifier

Defines how to identify a redelivered message for this policy.

Object Store

ObjectStore

The object store where the redelivery counter for each message will be stored.

### Redelivery Policy Message Identifier
FieldTypeDescriptionDefault ValueRequired

Use Secure Hash

Boolean

Whether to use a secure hash algorithm to identify a redelivered message.

Id Expression

String

Defines one or more expressions to use to determine when a message has been redelivered. Set this property only when Use Secure Hash is false.

### Repeatable In Memory Iterable
FieldTypeDescriptionDefault ValueRequired

Initial Buffer Size

Number

This is the number of instances initially allowed to be kept in memory in order to consume the stream and provide random access to it. If the stream contains more data than can fit into this buffer, then it will be expanded according to the Buffer size increment attribute, with an upper limit of Max in memory size. Default value is 100 instances.

Buffer Size Increment

Number

How much the buffer size will expand if it exceeds its initial specified size. Setting a value of zero or lower means that the buffer should not expand, and that a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised when the buffer gets full. Default value is 100 instances.

Max in Memory Instances

Number

This is the maximum amount of memory to use. If more than the maximum amount is used, then a STREAM_MAXIMUM_SIZE_EXCEEDED error will be raised. A value lower or equal to zero means no limit.

### Repeatable File Store Iterable
FieldTypeDescriptionDefault ValueRequired

In Memory Objects

Number

The maximum number of instances to keep in memory. If more than the maximum is required, content starts to buffer to the disk.

## See Also [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # SFTP Connector Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To fully benefit from using Anypoint Connector for SFTP (SFTP Connector), see the following examples of configuring the connector operations: - [Read a File](https://docs.mulesoft.com/sftp-connector/2.5/sftp-read) Configure the **Read** operation to read a file at any point in the flow. - [Write a File](https://docs.mulesoft.com/sftp-connector/2.5/sftp-write) Configure the **Write** operation to write content into the given path on demand. - [List Files](https://docs.mulesoft.com/sftp-connector/2.5/sftp-list) Configure the **List** operation to list the files and folders in the configured directory path. - [Copy and Move Files](https://docs.mulesoft.com/sftp-connector/2.5/sftp-copy-move) Configure the **Copy** and **Move** operations to copy or move files or directories on demand. - [Create a Directory](https://docs.mulesoft.com/sftp-connector/2.5/sftp-create-directory) Configure the **Create Directory** operation to create a directory of a given name. - [Trigger a Flow for a New Created or Updated File](https://docs.mulesoft.com/sftp-connector/2.5/sftp-on-new-file) Configure the **On New or Updated File** source to trigger a flow for a new created or modified file. - [Connect to an SFTP Server](https://docs.mulesoft.com/sftp-connector/2.5/sftp-connection) Configure the SFTP global configuration element to connect to an SFTP server, or to connect to an SFTP server through a proxy. - [Connect to SFTP Servers Dynamically](https://docs.mulesoft.com/sftp-connector/2.5/sftp-connection-dynamically) Configure SFTP Connector to connect dynamically to multiple servers. - [Disable pooling in SFTP Configuration](https://docs.mulesoft.com/sftp-connector/2.5/sftp-pooling) Disable connection pooling in SFTP Connector configuration to make sure no connection is active if there is nothing to transfer. - [Configure Preferred Authentication](https://docs.mulesoft.com/sftp-connector/2.5/sftp-preferred-authentication) Configure the preferred authentication for the SFTP Connection. - [Configure Security Parameters of SSH Connection](https://docs.mulesoft.com/sftp-connector/2.5/sftp-security-configuration-override) Override default security configuration of SSH Connection. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # SFTP Connector Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To fully benefit from using Anypoint Connector for SFTP (SFTP Connector), see the following examples of configuring the connector operations: - [Read a File](https://docs.mulesoft.com/sftp-connector/2.6/sftp-read) Configure the **Read** operation to read a file at any point in the flow. - [Write a File](https://docs.mulesoft.com/sftp-connector/2.6/sftp-write) Configure the **Write** operation to write content into the given path on demand. - [List Files](https://docs.mulesoft.com/sftp-connector/2.6/sftp-list) Configure the **List** operation to list the files and folders in the configured directory path. - [Copy and Move Files](https://docs.mulesoft.com/sftp-connector/2.6/sftp-copy-move) Configure the **Copy** and **Move** operations to copy or move files or directories on demand. - [Create a Directory](https://docs.mulesoft.com/sftp-connector/2.6/sftp-create-directory) Configure the **Create Directory** operation to create a directory of a given name. - [Trigger a Flow for a New Created or Updated File](https://docs.mulesoft.com/sftp-connector/2.6/sftp-on-new-file) Configure the **On New or Updated File** source to trigger a flow for a new created or modified file. - [Connect to an SFTP Server](https://docs.mulesoft.com/sftp-connector/2.6/sftp-connection) Configure the SFTP global configuration element to connect to an SFTP server, or to connect to an SFTP server through a proxy. - [Connect to SFTP Servers Dynamically](https://docs.mulesoft.com/sftp-connector/2.6/sftp-connection-dynamically) Configure SFTP Connector to connect dynamically to multiple servers. - [Disable pooling in SFTP Configuration](https://docs.mulesoft.com/sftp-connector/2.6/sftp-pooling) Disable connection pooling in SFTP Connector configuration to make sure no connection is active if there is nothing to transfer. - [Configure Preferred Authentication](https://docs.mulesoft.com/sftp-connector/2.6/sftp-preferred-authentication) Configure the preferred authentication for the SFTP Connection. - [Configure Security Parameters of SSH Connection](https://docs.mulesoft.com/sftp-connector/2.6/sftp-security-configuration-override) Override default security configuration of SSH Connection. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # SFTP Connector Examples > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To fully benefit from using Anypoint Connector for SFTP (SFTP Connector), see the following examples of configuring the connector operations: - [Read a File](https://docs.mulesoft.com/sftp-connector/latest/sftp-read) Configure the **Read** operation to read a file at any point in the flow. - [Write a File](https://docs.mulesoft.com/sftp-connector/latest/sftp-write) Configure the **Write** operation to write content into the given path on demand. - [List Files](https://docs.mulesoft.com/sftp-connector/latest/sftp-list) Configure the **List** operation to list the files and folders in the configured directory path. - [Copy and Move Files](https://docs.mulesoft.com/sftp-connector/latest/sftp-copy-move) Configure the **Copy** and **Move** operations to copy or move files or directories on demand. - [Create a Directory](https://docs.mulesoft.com/sftp-connector/latest/sftp-create-directory) Configure the **Create Directory** operation to create a directory of a given name. - [Trigger a Flow for a New Created or Updated File](https://docs.mulesoft.com/sftp-connector/latest/sftp-on-new-file) Configure the **On New or Updated File** source to trigger a flow for a new created or modified file. - [Connect to an SFTP Server](https://docs.mulesoft.com/sftp-connector/latest/sftp-connection) Configure the SFTP global configuration element to connect to an SFTP server, or to connect to an SFTP server through a proxy. - [Connect to SFTP Servers Dynamically](https://docs.mulesoft.com/sftp-connector/latest/sftp-connection-dynamically) Configure SFTP Connector to connect dynamically to multiple servers. - [Disable pooling in SFTP Configuration](https://docs.mulesoft.com/sftp-connector/latest/sftp-pooling) Disable connection pooling in SFTP Connector configuration to make sure no connection is active if there is nothing to transfer. - [Configure Preferred Authentication](https://docs.mulesoft.com/sftp-connector/latest/sftp-preferred-authentication) Configure the preferred authentication for the SFTP Connection. - [Configure Security Parameters of SSH Connection](https://docs.mulesoft.com/sftp-connector/latest/sftp-security-configuration-override) Override default security configuration of SSH Connection. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # SFTP Connector XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio. If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can get access to the connector in your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. When you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location. It also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/sftp http://www.mulesoft.org/schema/mule/sftp /current/mule-sftp .xsd ``` This example shows how the namespace statements are placed in the `` XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml org.mule.connectors mule-sftp-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `sftp connector`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # SFTP Connector XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio. If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can get access to the connector in your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. When you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location. It also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/sftp http://www.mulesoft.org/schema/mule/sftp /current/mule-sftp .xsd ``` This example shows how the namespace statements are placed in the `` XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml org.mule.connectors mule-sftp-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `sftp connector`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # SFTP Connector XML and Maven Support > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Although you can manually code a Mule app in XML, it is more efficient to use Anypoint Studio. If you manually code a Mule runtime engine (Mule) app in XML, either from the Anypoint Studio XML editor or from a text editor, you can get access to the connector in your app by adding reference statements to both your XML Mule flow and the Apache Maven `pom.xml` file. When you add the connector in Studio, Studio automatically populates the XML code with the connector’s namespace and schema location. It also adds a dependency to the `pom.xml` file. ## Add a Namespace for the Connector Paste the following code inside the `` tag of the header of your configuration XML: ```xml http://www.mulesoft.org/schema/mule/sftp http://www.mulesoft.org/schema/mule/sftp /current/mule-sftp .xsd ``` This example shows how the namespace statements are placed in the `` XML block: ```xml ``` ## Add a POM File Dependency The Apache Maven `pom.xml` file generated by Anypoint Studio contains dependencies for a Mule app. If you code a Mule app manually, include this XML snippet in your `pom.xml` file to enable access to this connector: ```xml org.mule.connectors mule-sftp-connector x.x.x mule-plugin ``` Replace `x.x.x` with the version that corresponds to the connector you are using. To obtain the most up-to-date `pom.xml` file information: 1. Go to [Anypoint Exchange](https://www.mulesoft.com/exchange/). 2. In Exchange, click **Login** and supply your Anypoint Platform username and password. 3. In Exchange, search for `sftp connector`. 4. Select the connector. 5. Click **Dependency Snippets** near the upper right of the screen. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Trigger a Flow When a New File Is Created or Modified Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connectors for File, FTP, and SFTP provide an **On New or Updated File** operation that polls a directory for files that have been created or updated. A message is generated for each file that is found. The following strategies determine that a file is new: - Set the **Auto delete** field to **True** to delete each file after it is processed, which causes all files obtained in the next poll to be considered new. - Set the **Move to directory** field to move each file to a different directory after it is processed, which achieves the same effect as **Auto delete** but without erasing the file. - Set the **Watermark** field to pick only files that have been created or updated after the last poll was executed. You can also use a matcher for additional filtering of files. ## Configure the On New or Updated File Operation in Studio To add and configure the **On New or Updated File** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **On New or Updated File** operation. 2. Drag the **On New or Updated File** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Directory** field to the directory path on which pooled files are contained, for example, `test-data/in`. 6. Set the **Auto delete** field to **True**. 7. Select the **Watermark** field to enable watermarking. ![On New or Updated File operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-newupdated-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Trigger a Flow When a New File Is Created or Modified Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connectors for File, FTP, and SFTP provide an **On New or Updated File** operation that polls a directory for files that have been created or updated. A message is generated for each file that is found. The following strategies determine that a file is new: - Set the **Auto delete** field to **True** to delete each file after it is processed, which causes all files obtained in the next poll to be considered new. - Set the **Move to directory** field to move each file to a different directory after it is processed, which achieves the same effect as **Auto delete** but without erasing the file. - Set the **Watermark** field to pick only files that have been created or updated after the last poll was executed. You can also use a matcher for additional filtering of files. ## Configure the On New or Updated File Operation in Studio To add and configure the **On New or Updated File** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **On New or Updated File** operation. 2. Drag the **On New or Updated File** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Directory** field to the directory path on which pooled files are contained, for example, `test-data/in`. 6. Set the **Auto delete** field to **True**. 7. Select the **Watermark** field to enable watermarking. ![On New or Updated File operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-newupdated-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Trigger a Flow When a New File Is Created or Modified Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connectors for File, FTP, and SFTP provide an **On New or Updated File** operation that polls a directory for files that have been created or updated. A message is generated for each file that is found. The following strategies determine that a file is new: - Set the **Auto delete** field to **True** to delete each file after it is processed, which causes all files obtained in the next poll to be considered new. - Set the **Move to directory** field to move each file to a different directory after it is processed, which achieves the same effect as **Auto delete** but without erasing the file. - Set the **Watermark** field to pick only files that have been created or updated after the last poll was executed. You can also use a matcher for additional filtering of files. ## Configure the On New or Updated File Operation in Studio To add and configure the **On New or Updated File** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **On New or Updated File** operation. 2. Drag the **On New or Updated File** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. Set the **Directory** field to the directory path on which pooled files are contained, for example, `test-data/in`. 6. Set the **Auto delete** field to **True**. 7. Select the **Watermark** field to enable watermarking. ![On New or Updated File operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-newupdated-operation.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Troubleshooting SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To troubleshoot Anypoint Connector for SFTP (SFTP Connector), become familiar with the information about troubleshooting connectivity, permissions, and server-side issues, troubleshooting Mule application issues, interpreting commonly thrown messages, and troubleshooting identity file format issues. ## Troubleshoot Connectivity, Permissions and Server-Side Issues Sometimes when attempting to connect to an SFTP server you can experience problems establishing the connection because an SFTP server requires a configured encrypted communication channel. For example, you might need to enable specific encryption cyphers or key exchange algorithms, or indicate the location of certain authorization keys. To resolve this issue: 1. Locate the SFTP servers configuration file to review the parameters and settings regarding the connection, encryption methods, timeouts, and so forth. Correct configuration as necessary and customize the environment to suit your needs. For example, if you are using OpenSSH you can access the `sshd_config` file. 2. Use the configuration file to increase the logging level on the server side. ## Troubleshoot Mule Application Issues Sometimes you are not sure why the application is failing and you require a better understanding of what is going on in the app’s interaction with the SFTP server. To resolve this error: - Use the configuration file to increase the logging level on the server side. - Try to replicate the issue using an SFTP client, for example, Cyberduck or Filezilla. If the issue also occurs with these clients, then it is likely that the issue is not related to the Mule app. - Get better and more detailed logs on the Mule app side by enabling verbose logging for SFTP Connector and for the library Apache Mina: 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` path folder. 4. Open the `log4j2.xml` file inside the folder. 5. If the following line is already in the `log4j2.xml` file, uncomment it to enable it; otherwise, add it: ```xml ``` 6. Add the following argument to your run configuration: \`-M-Djavax.net.debug=ssl,handshake\` 7. To ensure the correlation ID is passed to child threads and visible in SSH logs, include the following argument in your run configuration: \`-Dlog4j2.isThreadContextMapInheritable=true\` - Try to minimize or remove unnecessary DataWeave data transformations (you could even use hard coded data) to minimize app’s complexity and determine whether the issue is with the interaction between the app and the SFTP server. To get further information about enabling verbose logging for SDK components in your Mule application, see the [Troubleshooting SDK components](https://docs.mulesoft.com/mule-sdk/latest/troubleshooting) documentation. ## Understand Common Throws Here is a list of common throws messages and how to interpret them. - SFTP:ILLEGAL\_PATH The specified path is invalid because, for example, it does not exist. - SFTP:FILE\_ALREADY\_EXISTS An attempt was made to create a file at the same location and with the same name as an existing file. This happens, for example, when attempting to write a file using the CREATE\_NEW write mode to the path of an already existing file. - SFTP:ACCESS\_DENIED An operation made an attempt to access an SFTP server path and perform an action for which the user has not been granted permission. - SFTP:FILE\_LOCK An operation made an unsuccessful attempt to acquire a lock over a file. - SFTP:ILLEGAL\_CONTENT The \*Write\* operation received invalid content to write. - SFTP:CONNECTIVITY The connection to the SFTP server was interrupted. - SFTP:INVALID\_CREDENTIALS Authentication against the SFTP server failed due to invalid credentials. - SFTP:CONNECTION\_TIMEOUT The attempt to connect to the SFTP server timed out. - SFTP:CANNOT\_REACH An error occurred while attempting to establish the connection to the indicated SFTP server host and port. Typically, the connection is refused remotely, for example, if no process is listening on the remote address or port. - SFTP:UNKNOWN\_HOST Mule cannot determine the IP address of a host. - SFTP:DISCONNECTED The app made too many failed login attempts to a server. This can result from multiple causes, but the most common one is invalid credentials. - SFTP:KEY\_EXCHANGE\_FAILED The app tried to make an SSH connection to the server, but failed in the key exchange step. Failure may occur during the negotiation or later steps in the key exchange. - FILE\_DOESNT\_EXIST The file to write was deleted. ## Troubleshoot SFTP Connector Issues with a PPK Identity File When using the SFTP Connector version 2.0.0 and later with the preferred authentication method set to `PUBLIC_KEY`, you can face issues if the `Identity` file is PPK. The `Apache Mina library` doesn’t support the PPK file format, so the application fails. To resolve this issue: 1. Convert the PPK `Identity` file to PEM by using `PuTTYgen`. 2. Update the configuration file to use the PEM file. ```xml ``` ## See Also - [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/2.5/sftp-documentation) - [Salesforce Help](https://help.salesforce.com) - [Known Issues](https://help.salesforce.com/s/issues) --- product: SFTP Connector version: 2.6 --- # Troubleshooting SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To troubleshoot Anypoint Connector for SFTP (SFTP Connector), become familiar with the information about troubleshooting connectivity, permissions, and server-side issues, troubleshooting Mule application issues, interpreting commonly thrown messages, and troubleshooting identity file format issues. ## Troubleshoot Connectivity, Permissions and Server-Side Issues Sometimes when attempting to connect to an SFTP server you can experience problems establishing the connection because an SFTP server requires a configured encrypted communication channel. For example, you might need to enable specific encryption cyphers or key exchange algorithms, or indicate the location of certain authorization keys. To resolve this issue: 1. Locate the SFTP servers configuration file to review the parameters and settings regarding the connection, encryption methods, timeouts, and so forth. Correct configuration as necessary and customize the environment to suit your needs. For example, if you are using OpenSSH you can access the `sshd_config` file. 2. Use the configuration file to increase the logging level on the server side. ## Troubleshoot Mule Application Issues Sometimes you are not sure why the application is failing and you require a better understanding of what is going on in the app’s interaction with the SFTP server. To resolve this error: - Use the configuration file to increase the logging level on the server side. - Try to replicate the issue using an SFTP client, for example, Cyberduck or Filezilla. If the issue also occurs with these clients, then it is likely that the issue is not related to the Mule app. - Get better and more detailed logs on the Mule app side by enabling verbose logging for SFTP Connector: 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` path folder. 4. Open the `log4j2.xml` file inside the folder. 5. If the following line is already in the `log4j2.xml` file, uncomment it to enable it; otherwise, add it: ```xml ``` 6. To ensure the correlation ID is passed to child threads and visible in SSH logs, include the following argument in your run configuration: \-Dlog4j2.isThreadContextMapInheritable=true - Try to minimize or remove unnecessary DataWeave data transformations (you could even use hard coded data) to minimize app’s complexity and determine whether the issue is with the interaction between the app and the SFTP server. To get further information about enabling verbose logging for SDK components in your Mule application, see the [Troubleshooting SDK components](https://docs.mulesoft.com/mule-sdk/latest/troubleshooting) documentation. ## Enable Apache SSHD Library Logging > [!NOTE] Enabling TRACE level logging for `org.apache.sshd` generates a high volume of debug logs > that can cause severe performance degradation, including high CPU usage, thread contention, and > system-wide delays. 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` path folder. 4. Open the `log4j2.xml` file inside the folder. 5. Add this line to enable Apache SSHD library logging: ```xml ``` ## Enable SSL/TLS Handshake Debugging For diagnosing SSL/TLS handshake issues, add this argument to your run configuration: `-M-Djavax.net.debug=ssl,handshake` This argument enables detailed SSL/TLS debugging output. Use the argument only when troubleshooting encryption-related connection issues. ## Understand Common Throws Here is a list of common throws messages and how to interpret them. - SFTP:ILLEGAL\_PATH The specified path is invalid because, for example, it does not exist. - SFTP:FILE\_ALREADY\_EXISTS An attempt was made to create a file at the same location and with the same name as an existing file. This happens, for example, when attempting to write a file using the CREATE\_NEW write mode to the path of an already existing file. - SFTP:ACCESS\_DENIED An operation made an attempt to access an SFTP server path and perform an action for which the user has not been granted permission. - SFTP:FILE\_LOCK An operation made an unsuccessful attempt to acquire a lock over a file. - SFTP:ILLEGAL\_CONTENT The \*Write\* operation received invalid content to write. - SFTP:CONNECTIVITY The connection to the SFTP server was interrupted. - SFTP:INVALID\_CREDENTIALS Authentication against the SFTP server failed due to invalid credentials. - SFTP:CONNECTION\_TIMEOUT The attempt to connect to the SFTP server timed out. - SFTP:CANNOT\_REACH An error occurred while attempting to establish the connection to the indicated SFTP server host and port. Typically, the connection is refused remotely, for example, if no process is listening on the remote address or port. - SFTP:UNKNOWN\_HOST Mule cannot determine the IP address of a host. - SFTP:DISCONNECTED The app made too many failed login attempts to a server. This can result from multiple causes, but the most common one is invalid credentials. - SFTP:KEY\_EXCHANGE\_FAILED The app tried to make an SSH connection to the server, but failed in the key exchange step. Failure may occur during the negotiation or later steps in the key exchange. - FILE\_DOESNT\_EXIST The file to write was deleted. ## Troubleshoot SFTP Connector Issues with a PPK Identity File When using the SFTP Connector version 2.0.0 and later with the preferred authentication method set to `PUBLIC_KEY`, you can face issues if the `Identity` file is PPK. The `Apache Mina library` doesn’t support the PPK file format, so the application fails. To resolve this issue: 1. Convert the PPK `Identity` file to PEM by using `PuTTYgen`. 2. Update the configuration file to use the PEM file. ```xml ``` ## Standard Append Mode Overwrites or Fails When using the `APPEND` write mode, SFTP Connector overwrites the existing file instead of appending data to it, or the operation fails with a generic error. This behavior occurs when the target SFTP server is a legacy system that doesn’t support the `SSH_FXF_APPEND` flag. Without this flag, the server can’t natively process a request to append data to an existing file. To resolve this issue: 1. In the **Write** operation configuration, set the **Write Strategy** field to `CUSTOM`. 2. Set the **Write Mode** field to `CUSTOM_APPEND`. 3. Adjust the **Buffer Size for Write Strategy** field. When using `CUSTOM_APPEND`, this field defines the size of the data chunks sent to the server. For legacy servers with high latency or restricted packet sizes, adjusting this value can significantly improve performance and stability. > [!NOTE] The `CUSTOM_APPEND` strategy manually calculates the file offset to ensure data is added > to the end of the file. Use this strategy only for legacy servers that don’t support the > `STANDARD` strategy, as it doesn’t support concurrent writes to the same file. ## See Also - [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/2.6/sftp-documentation) - [Salesforce Help](https://help.salesforce.com) - [Known Issues](https://help.salesforce.com/s/issues) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Troubleshooting SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt To troubleshoot Anypoint Connector for SFTP (SFTP Connector), become familiar with the information about troubleshooting connectivity, permissions, and server-side issues, troubleshooting Mule application issues, interpreting commonly thrown messages, and troubleshooting identity file format issues. ## Troubleshoot Connectivity, Permissions and Server-Side Issues Sometimes when attempting to connect to an SFTP server you can experience problems establishing the connection because an SFTP server requires a configured encrypted communication channel. For example, you might need to enable specific encryption cyphers or key exchange algorithms, or indicate the location of certain authorization keys. To resolve this issue: 1. Locate the SFTP servers configuration file to review the parameters and settings regarding the connection, encryption methods, timeouts, and so forth. Correct configuration as necessary and customize the environment to suit your needs. For example, if you are using OpenSSH you can access the `sshd_config` file. 2. Use the configuration file to increase the logging level on the server side. ## Troubleshoot Connection Timeout Errors A generic timeout error, such as `Failed to get operation result within specified timeout`, can be caused by session limits on the remote SFTP server or by transient network issues. Check the server-side settings, use the latest version of SFTP Connector, and configure a robust [reconnection strategy](https://docs.mulesoft.com/mule-runtime/latest/reconnection-strategy-about). ## Troubleshoot Authentication Failures Log messages that reference `ClientUserAuthService.tryNext` mean that the TCP and SSH handshake succeeded, but the server rejected the credentials. Verify that the credentials and the authentication method match what the server expects. ## Interpret Opened and Authed Sessions In the SSH logs, `Opened` means the SSH handshake is complete, and `Authed` means authentication was successful. A `Connection reset` or `AuthTimeout` error while the session is `Opened` means that authentication failed or timed out. ## Troubleshoot Mule Application Issues Sometimes you are not sure why the application is failing and you require a better understanding of what is going on in the app’s interaction with the SFTP server. To resolve this error: - Use the configuration file to increase the logging level on the server side. - Try to replicate the issue using an SFTP client, for example, Cyberduck or Filezilla. If the issue also occurs with these clients, then it is likely that the issue is not related to the Mule app. - Get better and more detailed logs on the Mule app side by enabling verbose logging for SFTP Connector: 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` path folder. 4. Open the `log4j2.xml` file inside the folder. 5. If the following line is already in the `log4j2.xml` file, uncomment it to enable it; otherwise, add it: ```xml ``` 6. To ensure the correlation ID is passed to child threads and visible in SSH logs, include the following argument in your run configuration: \-Dlog4j2.isThreadContextMapInheritable=true - Try to minimize or remove unnecessary DataWeave data transformations (you could even use hard coded data) to minimize app’s complexity and determine whether the issue is with the interaction between the app and the SFTP server. To get further information about enabling verbose logging for SDK components in your Mule application, see the [Troubleshooting SDK components](https://docs.mulesoft.com/mule-sdk/latest/troubleshooting) documentation. ## Enable Apache SSHD Library Logging > [!NOTE] Enabling TRACE level logging for `org.apache.sshd` generates a high volume of debug logs > that can cause severe performance degradation, including high CPU usage, thread contention, and > system-wide delays. 1. Access Anypoint Studio and navigate to the **Package Explorer** view. 2. Open your application’s project name. 3. Open the `src/main/resources` path folder. 4. Open the `log4j2.xml` file inside the folder. 5. Add this line to enable Apache SSHD library logging: ```xml ``` ## Enable SSL/TLS Handshake Debugging For diagnosing SSL/TLS handshake issues, add this argument to your run configuration: `-M-Djavax.net.debug=ssl,handshake` This argument enables detailed SSL/TLS debugging output. Use the argument only when troubleshooting encryption-related connection issues. ## Understand Common Throws Here is a list of common throws messages and how to interpret them. - SFTP:ILLEGAL\_PATH The specified path is invalid because, for example, it does not exist. - SFTP:FILE\_ALREADY\_EXISTS An attempt was made to create a file at the same location and with the same name as an existing file. This happens, for example, when attempting to write a file using the CREATE\_NEW write mode to the path of an already existing file. - SFTP:ACCESS\_DENIED An operation made an attempt to access an SFTP server path and perform an action for which the user has not been granted permission. - SFTP:FILE\_LOCK An operation made an unsuccessful attempt to acquire a lock over a file. - SFTP:ILLEGAL\_CONTENT The \*Write\* operation received invalid content to write. - SFTP:CONNECTIVITY The connection to the SFTP server was interrupted. - SFTP:INVALID\_CREDENTIALS Authentication against the SFTP server failed due to invalid credentials. - SFTP:CONNECTION\_TIMEOUT The attempt to connect to the SFTP server timed out. - SFTP:CANNOT\_REACH An error occurred while attempting to establish the connection to the indicated SFTP server host and port. Typically, the connection is refused remotely, for example, if no process is listening on the remote address or port. - SFTP:UNKNOWN\_HOST Mule cannot determine the IP address of a host. - SFTP:DISCONNECTED The app made too many failed login attempts to a server. This can result from multiple causes, but the most common one is invalid credentials. - SFTP:KEY\_EXCHANGE\_FAILED The app tried to make an SSH connection to the server, but failed in the key exchange step. Failure may occur during the negotiation or later steps in the key exchange. - FILE\_DOESNT\_EXIST The file to write was deleted. ## Troubleshoot SFTP Connector Issues with a PPK Identity File When using the SFTP Connector version 2.0.0 and later with the preferred authentication method set to `PUBLIC_KEY`, you can face issues if the `Identity` file is PPK. The `Apache Mina library` doesn’t support the PPK file format, so the application fails. To resolve this issue: 1. Convert the PPK `Identity` file to PEM by using `PuTTYgen`. 2. Update the configuration file to use the PEM file. ```xml ``` ## Standard Append Mode Overwrites or Fails When using the `APPEND` write mode, SFTP Connector overwrites the existing file instead of appending data to it, or the operation fails with a generic error. This behavior occurs when the target SFTP server is a legacy system that doesn’t support the `SSH_FXF_APPEND` flag. Without this flag, the server can’t natively process a request to append data to an existing file. To resolve this issue: 1. In the **Write** operation configuration, set the **Write Strategy** field to `CUSTOM`. 2. Set the **Write Mode** field to `CUSTOM_APPEND`. 3. Adjust the **Buffer Size for Write Strategy** field. When using `CUSTOM_APPEND`, this field defines the size of the data chunks sent to the server. For legacy servers with high latency or restricted packet sizes, adjusting this value can significantly improve performance and stability. > [!NOTE] The `CUSTOM_APPEND` strategy manually calculates the file offset to ensure data is added > to the end of the file. Use this strategy only for legacy servers that don’t support the > `STANDARD` strategy, as it doesn’t support concurrent writes to the same file. ## See Also - [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/latest/sftp-documentation) - [Salesforce Help](https://help.salesforce.com) - [Known Issues](https://help.salesforce.com/s/issues) --- product: SFTP Connector version: 2.5 --- # Upgrade and Migrate SFTP Connector to Version 2.x > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Upgrade Anypoint Connector for SFTP (SFTP Connector) to version 2.x.x. ## Supported Upgrade Paths
From VersionTo Version

1.6.0

2.x.x

## Changes in This Release This release contains the following changes: - The connector has a new custom [**write strategy**](https://docs.mulesoft.com/sftp-connector/latest/sftp-write#write-strategy) field that enables you to configure the strategy to write a file. - The system property `mule.sftp.useHomeDirectory` was removed. SFTP Connector now uses the default home directory. - SFTP Connector 2.x.x no longer supports the `jcraft library`. The connector now uses the `apache mina sshd` library. - The **List** operation no longer fetches the content of each file. Now, the payload of each list item contains the complete path to the found file or directory. - The SFTP **Regular Size** file attribute is renamed to **Regular File** because its behavior is not related to size. The file attribute value can be a file (`true`) or a directory (`false`). - SFTP Connector 2.x.x does not support ciphers `3des-ctr` and `arcfour`. For more information, refer to [Supported Ciphers project](#supported-ciphers). - The SFTP proxy protocol works only with HTTP and SOCKS5. - SFTP Connector no longer uses `javax.activation` to resolve the media types of the files. The connector now uses `Apache Tika`, which can result in different media file interpretations. - The connector changed the classes to manage the date from `LocalDateTime` to `ZonedDateTime`. - The deprecated **Encoding** parameter in the configuration and **Write** operation is removed. The connector uses the Mule’s default encoding. ## Upgrade Prerequisites Before you perform the upgrade, you must complete the following: - Create a backup of your files, data, and configurations in case you need to restore to them. ## Upgrade Steps Follow these steps to perform the upgrade: 1. In Anypoint Studio, create a Mule project. 2. In **Mule Palette**, click **Search in Exchange**. 3. In **Add Dependencies to Project**, enter `SFTP` in the search field. 4. In **Available modules**, select **SFTP Connector** and click **Add**. 5. Click **Finish**. 6. Verify that the SFTP Connector `mule-sftp-connector` version is `2.x.x` in the `pom.xml` file in the Mule project. Studio upgrades the connector automatically. ## Post Upgrade Steps After you install the latest version of the connector, follow these steps to complete the upgrade: ### Verify the Upgrade After you install the latest version of the connector, verify the upgrade: 1. In Studio, verify that there are no errors in the **Problems** or **Console** views. 2. Verify that there are no problems in the project `pom.xml` file. 3. Test the connection to verify that the operations work. ## Supported Ciphers The Apache Mina SSHD library does not support ciphers `3des-ctr` and `arcfour`. Additionally, the library introduces `aes128-gcm`, `aes256-gcm`, and `cc20p1305_openssh` as alternatives. > [!NOTE] For the current version of the SFTP Connector, you must stick to the Apache Mina default > options. Refer to the > [Apache Mina Supported Standards](https://github.com/apache/mina-sshd/blob/sshd-2.12.1/docs/standards.md#implementedavailable-support). For details, review the following table:
JSCH - SFTP Connector 1.6MINA SSHD - SFTP Connector 2.0

blowfish-cbc

blowfish-cbc (Deprecated)

3des-cbc

3des-cbc (Deprecated)

3des-ctr

Not supported.

aes128-cbc

aes128-cbc

aes128-ctr

aes128-ctr

Not supported.

aes128-gcm

aes192-cbc

aes192-cbc

aes192-ctr

aes192-ctr

aes256-cbc

aes256-cbc

aes256-ctr

aes256-ctr

Not supported.

aes256-gcm

arcfour

Not supported.

arcfour128

arcfour128 (Deprecated)

arcfour256

arcfour256 (Deprecated)

Not supported.

cc20p1305_openssh

## Other Supported Cryptographic Entities
Kex AlgorithmsHost Key AlgorithmsMACs

curve25519-sha256*

ecdsa-sha2-nistp256-cert-v01@openssh.com

hmac-sha2-256-etm@openssh.com

curve25519-sha256@libssh.org*

ecdsa-sha2-nistp384-cert-v01@openssh.com

hmac-sha2-512-etm@openssh.com

curve448-sha512*

ecdsa-sha2-nistp521-cert-v01@openssh.com

hmac-sha1-etm@openssh.com

ecdh-sha2-nistp521

ssh-ed25519-cert-v01@openssh.com

hmac-sha2-256

ecdh-sha2-nistp384

rsa-sha2-512-cert-v01@openssh.com

hmac-sha2-512

ecdh-sha2-nistp256

rsa-sha2-256-cert-v01@openssh.com

hmac-sha1

diffie-hellman-group-exchange-sha256

ecdsa-sha2-nistp256

hmac-md5 (Deprecated)

diffie-hellman-group18-sha512

ecdsa-sha2-nistp384

hmac-md5-96 (Deprecated)

diffie-hellman-group17-sha512

ecdsa-sha2-nistp521

hmac-sha1-96 (Deprecated)

diffie-hellman-group16-sha512

ssh-ed25519**

diffie-hellman-group15-sha512

sk-ecdsa-sha2-nistp256@openssh.com

diffie-hellman-group14-sha256

sk-ssh-ed25519@openssh.com**

diffie-hellman-group1-sha1 (Deprecated)

rsa-sha2-512

diffie-hellman-group14-sha1 (Deprecated)

rsa-sha2-256

diffie-hellman-group-exchange-sha1 (Deprecated)

ssh-rsa

ssh-dss (Deprecated)

ssh-dss-cert-v01@openssh.com (Deprecated)

ssh-rsa-cert-v01@openssh.com (Deprecated)

`*` These algorithms require Bouncy Castle on Java versions before Java 11. `**` These algorithms require externally EdDSA (Edwards-curve Digital Signature Algorithm) library. ## Troubleshooting ### Reverting the Upgrade If you need to revert to the previous version of SFTP Connector, go to Anypoint Studio and in the project’s `pom.xml` file, change the `mule-sftp-connector` dependency version 2.x.x to the previous version. ### Override SSH Connection Security Configuration If you face SSH connection issues due to unsupported ciphers, macs, hostKeyAlgorithms or kexAlgorithms, then change the priority or enable deprecated ciphers and algorithms forcefully. Although using this method may introduce additional risk. Refer to [Configure Security Parameters of SSH Connection](https://docs.mulesoft.com/sftp-connector/2.5/sftp-security-configuration-override) and [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/2.5/sftp-documentation). ### Override Standard Write Strategy If your **File Write** operation overrides instead of appending when using the `APPEND` mode, use the `CUSTOM` write strategy along with the `CUSTOM_APPEND` mode only as it isn’t applicable to the other modes. With this strategy, you can manually specify the offset for the server to write the file in `APPEND` mode, particularly only for older SFTP servers that don’t directly support write modes. Use this strategy only if the `STANDARD` strategy results in errors during file writing in `APPEND` mode and doesn’t offer concurrency. Additionally, you can adjust the buffer size in the **Buffer Size for Write Strategy** field. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Upgrade and Migrate SFTP Connector to Version 2.x > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Upgrade Anypoint Connector for SFTP (SFTP Connector) to version 2.x.x. ## Supported Upgrade Paths
From VersionTo Version

1.6.0

2.x.x

## Changes in This Release This release contains the following changes: - The connector has a new custom [**write strategy**](https://docs.mulesoft.com/sftp-connector/latest/sftp-write#write-strategy) field that enables you to configure the strategy to write a file. - The system property `mule.sftp.useHomeDirectory` was removed. SFTP Connector now uses the default home directory. - SFTP Connector 2.x.x no longer supports the `jcraft library`. The connector now uses the `apache mina sshd` library. - The **List** operation no longer fetches the content of each file. Now, the payload of each list item contains the complete path to the found file or directory. - The SFTP **Regular Size** file attribute is renamed to **Regular File** because its behavior is not related to size. The file attribute value can be a file (`true`) or a directory (`false`). - SFTP Connector 2.x.x does not support ciphers `3des-ctr` and `arcfour`. For more information, refer to [Supported Ciphers project](#supported-ciphers). - The SFTP proxy protocol works only with HTTP and SOCKS5. - SFTP Connector no longer uses `javax.activation` to resolve the media types of the files. The connector now uses `Apache Tika`, which can result in different media file interpretations. - The connector changed the classes to manage the date from `LocalDateTime` to `ZonedDateTime`. - The deprecated **Encoding** parameter in the configuration and **Write** operation is removed. The connector uses the Mule’s default encoding. ## Upgrade Prerequisites Before you perform the upgrade, you must complete the following: - Create a backup of your files, data, and configurations in case you need to restore to them. ## Upgrade Steps Follow these steps to perform the upgrade: 1. In Anypoint Studio, create a Mule project. 2. In **Mule Palette**, click **Search in Exchange**. 3. In **Add Dependencies to Project**, enter `SFTP` in the search field. 4. In **Available modules**, select **SFTP Connector** and click **Add**. 5. Click **Finish**. 6. Verify that the SFTP Connector `mule-sftp-connector` version is `2.x.x` in the `pom.xml` file in the Mule project. Studio upgrades the connector automatically. ## Post Upgrade Steps After you install the latest version of the connector, follow these steps to complete the upgrade: ### Verify the Upgrade After you install the latest version of the connector, verify the upgrade: 1. In Studio, verify that there are no errors in the **Problems** or **Console** views. 2. Verify that there are no problems in the project `pom.xml` file. 3. Test the connection to verify that the operations work. ## Supported Ciphers The Apache Mina SSHD library does not support ciphers `3des-ctr` and `arcfour`. Additionally, the library introduces `aes128-gcm`, `aes256-gcm`, and `cc20p1305_openssh` as alternatives. > [!NOTE] For the current version of the SFTP Connector, you must stick to the Apache Mina default > options. Refer to the > [Apache Mina Supported Standards](https://github.com/apache/mina-sshd/blob/sshd-2.12.1/docs/standards.md#implementedavailable-support). For details, review the following table:
JSCH - SFTP Connector 1.6MINA SSHD - SFTP Connector 2.0

blowfish-cbc

blowfish-cbc (Deprecated)

3des-cbc

3des-cbc (Deprecated)

3des-ctr

Not supported.

aes128-cbc

aes128-cbc

aes128-ctr

aes128-ctr

Not supported.

aes128-gcm

aes192-cbc

aes192-cbc

aes192-ctr

aes192-ctr

aes256-cbc

aes256-cbc

aes256-ctr

aes256-ctr

Not supported.

aes256-gcm

arcfour

Not supported.

arcfour128

arcfour128 (Deprecated)

arcfour256

arcfour256 (Deprecated)

Not supported.

cc20p1305_openssh

## Other Supported Cryptographic Entities
Kex AlgorithmsHost Key AlgorithmsMACs

curve25519-sha256*

ecdsa-sha2-nistp256-cert-v01@openssh.com

hmac-sha2-256-etm@openssh.com

curve25519-sha256@libssh.org*

ecdsa-sha2-nistp384-cert-v01@openssh.com

hmac-sha2-512-etm@openssh.com

curve448-sha512*

ecdsa-sha2-nistp521-cert-v01@openssh.com

hmac-sha1-etm@openssh.com

ecdh-sha2-nistp521

ssh-ed25519-cert-v01@openssh.com

hmac-sha2-256

ecdh-sha2-nistp384

rsa-sha2-512-cert-v01@openssh.com

hmac-sha2-512

ecdh-sha2-nistp256

rsa-sha2-256-cert-v01@openssh.com

hmac-sha1

diffie-hellman-group-exchange-sha256

ecdsa-sha2-nistp256

hmac-md5 (Deprecated)

diffie-hellman-group18-sha512

ecdsa-sha2-nistp384

hmac-md5-96 (Deprecated)

diffie-hellman-group17-sha512

ecdsa-sha2-nistp521

hmac-sha1-96 (Deprecated)

diffie-hellman-group16-sha512

ssh-ed25519**

diffie-hellman-group15-sha512

sk-ecdsa-sha2-nistp256@openssh.com

diffie-hellman-group14-sha256

sk-ssh-ed25519@openssh.com**

diffie-hellman-group1-sha1 (Deprecated)

rsa-sha2-512

diffie-hellman-group14-sha1 (Deprecated)

rsa-sha2-256

diffie-hellman-group-exchange-sha1 (Deprecated)

ssh-rsa

ssh-dss (Deprecated)

ssh-dss-cert-v01@openssh.com (Deprecated)

ssh-rsa-cert-v01@openssh.com (Deprecated)

`*` These algorithms require Bouncy Castle on Java versions before Java 11. `**` These algorithms require externally EdDSA (Edwards-curve Digital Signature Algorithm) library. ## Troubleshooting ### Reverting the Upgrade If you need to revert to the previous version of SFTP Connector, go to Anypoint Studio and in the project’s `pom.xml` file, change the `mule-sftp-connector` dependency version 2.x.x to the previous version. ### Override SSH Connection Security Configuration If you face SSH connection issues due to unsupported ciphers, macs, hostKeyAlgorithms or kexAlgorithms, then change the priority or enable deprecated ciphers and algorithms forcefully. Although using this method may introduce additional risk. Refer to [Configure Security Parameters of SSH Connection](https://docs.mulesoft.com/sftp-connector/2.6/sftp-security-configuration-override) and [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/2.6/sftp-documentation). ### Override Standard Write Strategy If your **File Write** operation overrides instead of appending when using the `APPEND` mode, use the `CUSTOM` write strategy along with the `CUSTOM_APPEND` mode only as it isn’t applicable to the other modes. With this strategy, you can manually specify the offset for the server to write the file in `APPEND` mode, particularly only for older SFTP servers that don’t directly support write modes. Use this strategy only if the `STANDARD` strategy results in errors during file writing in `APPEND` mode and doesn’t offer concurrency. Additionally, you can adjust the buffer size in the **Buffer Size for Write Strategy** field. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Upgrade and Migrate SFTP Connector to Version 2.x > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Upgrade Anypoint Connector for SFTP (SFTP Connector) to version 2.x.x. ## Supported Upgrade Paths
From VersionTo Version

1.6.0

2.x.x

## Changes in This Release This release contains the following changes: - The connector has a new custom [**write strategy**](https://docs.mulesoft.com/sftp-connector/latest/sftp-write#write-strategy) field that enables you to configure the strategy to write a file. - The system property `mule.sftp.useHomeDirectory` was removed. SFTP Connector now uses the default home directory. - SFTP Connector 2.x.x no longer supports the `jcraft library`. The connector now uses the `apache mina sshd` library. - The **List** operation no longer fetches the content of each file. Now, the payload of each list item contains the complete path to the found file or directory. - The SFTP **Regular Size** file attribute is renamed to **Regular File** because its behavior is not related to size. The file attribute value can be a file (`true`) or a directory (`false`). - SFTP Connector 2.x.x does not support ciphers `3des-ctr` and `arcfour`. For more information, refer to [Supported Ciphers project](#supported-ciphers). - The SFTP proxy protocol works only with HTTP and SOCKS5. - SFTP Connector no longer uses `javax.activation` to resolve the media types of the files. The connector now uses `Apache Tika`, which can result in different media file interpretations. - The connector changed the classes to manage the date from `LocalDateTime` to `ZonedDateTime`. - The deprecated **Encoding** parameter in the configuration and **Write** operation is removed. The connector uses the Mule’s default encoding. ## Upgrade Prerequisites Before you perform the upgrade, you must complete the following: - Create a backup of your files, data, and configurations in case you need to restore to them. ## Upgrade Steps Follow these steps to perform the upgrade: 1. In Anypoint Studio, create a Mule project. 2. In **Mule Palette**, click **Search in Exchange**. 3. In **Add Dependencies to Project**, enter `SFTP` in the search field. 4. In **Available modules**, select **SFTP Connector** and click **Add**. 5. Click **Finish**. 6. Verify that the SFTP Connector `mule-sftp-connector` version is `2.x.x` in the `pom.xml` file in the Mule project. Studio upgrades the connector automatically. ## Post Upgrade Steps After you install the latest version of the connector, follow these steps to complete the upgrade: ### Verify the Upgrade After you install the latest version of the connector, verify the upgrade: 1. In Studio, verify that there are no errors in the **Problems** or **Console** views. 2. Verify that there are no problems in the project `pom.xml` file. 3. Test the connection to verify that the operations work. ## Supported Ciphers The Apache Mina SSHD library does not support ciphers `3des-ctr` and `arcfour`. Additionally, the library introduces `aes128-gcm`, `aes256-gcm`, and `cc20p1305_openssh` as alternatives. > [!NOTE] For the current version of the SFTP Connector, you must stick to the Apache Mina default > options. Refer to the > [Apache Mina Supported Standards](https://github.com/apache/mina-sshd/blob/sshd-2.12.1/docs/standards.md#implementedavailable-support). For details, review the following table:
JSCH - SFTP Connector 1.6MINA SSHD - SFTP Connector 2.0

blowfish-cbc

blowfish-cbc (Deprecated)

3des-cbc

3des-cbc (Deprecated)

3des-ctr

Not supported.

aes128-cbc

aes128-cbc

aes128-ctr

aes128-ctr

Not supported.

aes128-gcm

aes192-cbc

aes192-cbc

aes192-ctr

aes192-ctr

aes256-cbc

aes256-cbc

aes256-ctr

aes256-ctr

Not supported.

aes256-gcm

arcfour

Not supported.

arcfour128

arcfour128 (Deprecated)

arcfour256

arcfour256 (Deprecated)

Not supported.

cc20p1305_openssh

## Other Supported Cryptographic Entities
Kex AlgorithmsHost Key AlgorithmsMACs

curve25519-sha256*

ecdsa-sha2-nistp256-cert-v01@openssh.com

hmac-sha2-256-etm@openssh.com

curve25519-sha256@libssh.org*

ecdsa-sha2-nistp384-cert-v01@openssh.com

hmac-sha2-512-etm@openssh.com

curve448-sha512*

ecdsa-sha2-nistp521-cert-v01@openssh.com

hmac-sha1-etm@openssh.com

ecdh-sha2-nistp521

ssh-ed25519-cert-v01@openssh.com

hmac-sha2-256

ecdh-sha2-nistp384

rsa-sha2-512-cert-v01@openssh.com

hmac-sha2-512

ecdh-sha2-nistp256

rsa-sha2-256-cert-v01@openssh.com

hmac-sha1

diffie-hellman-group-exchange-sha256

ecdsa-sha2-nistp256

hmac-md5 (Deprecated)

diffie-hellman-group18-sha512

ecdsa-sha2-nistp384

hmac-md5-96 (Deprecated)

diffie-hellman-group17-sha512

ecdsa-sha2-nistp521

hmac-sha1-96 (Deprecated)

diffie-hellman-group16-sha512

ssh-ed25519**

diffie-hellman-group15-sha512

sk-ecdsa-sha2-nistp256@openssh.com

diffie-hellman-group14-sha256

sk-ssh-ed25519@openssh.com**

diffie-hellman-group1-sha1 (Deprecated)

rsa-sha2-512

diffie-hellman-group14-sha1 (Deprecated)

rsa-sha2-256

diffie-hellman-group-exchange-sha1 (Deprecated)

ssh-rsa

ssh-dss (Deprecated)

ssh-dss-cert-v01@openssh.com (Deprecated)

ssh-rsa-cert-v01@openssh.com (Deprecated)

`*` These algorithms require Bouncy Castle on Java versions before Java 11. `**` These algorithms require externally EdDSA (Edwards-curve Digital Signature Algorithm) library. ## Troubleshooting ### Reverting the Upgrade If you need to revert to the previous version of SFTP Connector, go to Anypoint Studio and in the project’s `pom.xml` file, change the `mule-sftp-connector` dependency version 2.x.x to the previous version. ### Override SSH Connection Security Configuration If you face SSH connection issues due to unsupported ciphers, macs, hostKeyAlgorithms or kexAlgorithms, then change the priority or enable deprecated ciphers and algorithms forcefully. Although using this method may introduce additional risk. Refer to [Configure Security Parameters of SSH Connection](https://docs.mulesoft.com/sftp-connector/latest/sftp-security-configuration-override) and [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/latest/sftp-documentation). ### Override Standard Write Strategy If your **File Write** operation overrides instead of appending when using the `APPEND` mode, use the `CUSTOM` write strategy along with the `CUSTOM_APPEND` mode only as it isn’t applicable to the other modes. With this strategy, you can manually specify the offset for the server to write the file in `APPEND` mode, particularly only for older SFTP servers that don’t directly support write modes. Use this strategy only if the `STANDARD` strategy results in errors during file writing in `APPEND` mode and doesn’t offer concurrency. Additionally, you can adjust the buffer size in the **Buffer Size for Write Strategy** field. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Using Anypoint Studio to Configure SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [SFTP Connector Reference Reference](https://docs.mulesoft.com/sftp-connector/2.5/sftp-documentation). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add SFTP Connector to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `sftp` in the search field. 3. Click **SFTP Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with SFTP Connector: - **On New or Updated File** Initiates a flow by polling a directory for files that have been created or updated and generates a message for each file found. - **HTTP Listener** Initiates a flow each time it receives a request on the configured host and port. - **Scheduler** Initiates a flow when a time-based condition is met. For example, to configure the On New or Updated File source, follow these steps: 1. In the **Mule Palette** view, select **On New or Updated File**. 2. Drag **On New or Updated File** to the Studio canvas. 3. On the **On New or Updated File** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of **On New or Updated File** in the app. 6. On the **General** tab, specify the connection information for the connector. 7. Set the **Host** field to specify the SFTP server host, for example, `localhost` or `192.168.0.1`. 8. Click **Test Connection** to confirm that Mule can connect with the specified server. 9. Click **OK**. 10. On the **On New or Updated File** configuration screen, specify a **Scheduling Strategy** value and optionally complete other fields. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform. To add an operation for SFTP Connector, follow these steps: 1. In the **Mule Palette** view, select **SFTP** and then select the desired operation. 2. Drag the operation onto the Studio canvas and to the right of the source. The following screenshot shows the SFTP Connector operations in the Mule Palette view of Anypoint Studio: ![SFTP Connector Operations](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-operations.png) Figure 1. SFTP Connector Operations ## Configure a Global Element for the Connector When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to configure the SFTP server connection. To configure the global element for SFTP Connector, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector: 5. If you want EdDSA support, provide the EdDSA dependency by clicking **Configure** under the **Required Libraries** field. 6. Set the **Working Directory** as the root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 7. Set the **Host** field to specify the SFTP server host, for example, `localhost` or `192.168.0.1`. 8. On the **Advanced** tab, optionally specify a timeout configuration and reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. The following screenshot shows the SFTP Connector **Global Element Configuration** window in Anypoint Studio: ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-global-configuration-with-required-lib.png) Figure 2. SFTP Connector Global Element Configuration In the XML editor, the configuration `sftp:config` looks like this: ```xml ``` ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/2.5/sftp-documentation) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Using Anypoint Studio to Configure SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [SFTP Connector Reference Reference](https://docs.mulesoft.com/sftp-connector/2.6/sftp-documentation). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add SFTP Connector to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `sftp` in the search field. 3. Click **SFTP Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with SFTP Connector: - **On New or Updated File** Initiates a flow by polling a directory for files that have been created or updated and generates a message for each file found. - **HTTP Listener** Initiates a flow each time it receives a request on the configured host and port. - **Scheduler** Initiates a flow when a time-based condition is met. For example, to configure the On New or Updated File source, follow these steps: 1. In the **Mule Palette** view, select **On New or Updated File**. 2. Drag **On New or Updated File** to the Studio canvas. 3. On the **On New or Updated File** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of **On New or Updated File** in the app. 6. On the **General** tab, specify the connection information for the connector. 7. Set the **Host** field to specify the SFTP server host, for example, `localhost` or `192.168.0.1`. 8. Click **Test Connection** to confirm that Mule can connect with the specified server. 9. Click **OK**. 10. On the **On New or Updated File** configuration screen, specify a **Scheduling Strategy** value and optionally complete other fields. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform. To add an operation for SFTP Connector, follow these steps: 1. In the **Mule Palette** view, select **SFTP** and then select the desired operation. 2. Drag the operation onto the Studio canvas and to the right of the source. The following screenshot shows the SFTP Connector operations in the Mule Palette view of Anypoint Studio: ![SFTP Connector Operations](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-operations.png) Figure 1. SFTP Connector Operations ## Configure a Global Element for the Connector When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to configure the SFTP server connection. To configure the global element for SFTP Connector, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector: 5. If you want EdDSA support, provide the EdDSA dependency by clicking **Configure** under the **Required Libraries** field. 6. Set the **Working Directory** as the root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 7. Set the **Host** field to specify the SFTP server host, for example, `localhost` or `192.168.0.1`. 8. On the **Advanced** tab, optionally specify a timeout configuration and reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. The following screenshot shows the SFTP Connector **Global Element Configuration** window in Anypoint Studio: ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-global-configuration-with-required-lib.png) Figure 2. SFTP Connector Global Element Configuration In the XML editor, the configuration `sftp:config` looks like this: ```xml ``` ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/2.6/sftp-documentation) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Using Anypoint Studio to Configure SFTP Connector > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files. To add and configure a connector in Studio: 1. [Create a Mule project](#create-mule-project). 2. [Add the connector to your Mule project](#add-connector-to-project). 3. [Configure a source for the connector’s flow](#configure-input-source). 4. [Add a connector operation to the flow](#add-connector-operation). 5. [Configure a global element for the connector](#configure-global-element). When you run the connector, you can view the app log to check for problems in real time, as described in [View the App Log](#view-app-log). If you are new to configuring connectors in Studio, see [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio). If, after reading this topic, you need additional information about the connector fields, see the [SFTP Connector Reference Reference](https://docs.mulesoft.com/sftp-connector/latest/sftp-documentation). ## Create a Mule Project In Studio, create a new Mule project in which to add and configure the connector: 1. In Studio, select **File > New > Mule Project**. 2. Enter a name for your Mule project and click **Finish**. ## Add the Connector to Your Mule Project Add SFTP Connector to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and to add the required dependencies to the project’s `pom.xml` file: 1. In the **Mule Palette** view, click **(X) Search in Exchange**. 2. In the **Add Dependencies to Project** window, type `sftp` in the search field. 3. Click **SFTP Connector** in **Available modules**. 4. Click **Add**. 5. Click **Finish**. Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace. ## Configure a Source A source initiates a flow when a specified condition is met. You can configure one of these sources to use with SFTP Connector: - **On New or Updated File** Initiates a flow by polling a directory for files that have been created or updated and generates a message for each file found. - **HTTP Listener** Initiates a flow each time it receives a request on the configured host and port. - **Scheduler** Initiates a flow when a time-based condition is met. For example, to configure the On New or Updated File source, follow these steps: 1. In the **Mule Palette** view, select **On New or Updated File**. 2. Drag **On New or Updated File** to the Studio canvas. 3. On the **On New or Updated File** configuration screen, optionally change the value of the **Display Name** field. 4. Specify a value for the **Path** field. 5. Click the plus sign (**+**) next to the **Connector configuration** field to configure a global element that can be used by all instances of **On New or Updated File** in the app. 6. On the **General** tab, specify the connection information for the connector. 7. Set the **Host** field to specify the SFTP server host, for example, `localhost` or `192.168.0.1`. 8. Click **Test Connection** to confirm that Mule can connect with the specified server. 9. Click **OK**. 10. On the **On New or Updated File** configuration screen, specify a **Scheduling Strategy** value and optionally complete other fields. ## Add a Connector Operation to the Flow When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform. To add an operation for SFTP Connector, follow these steps: 1. In the **Mule Palette** view, select **SFTP** and then select the desired operation. 2. Drag the operation onto the Studio canvas and to the right of the source. The following screenshot shows the SFTP Connector operations in the Mule Palette view of Anypoint Studio: ![SFTP Connector Operations](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-operations.png) Figure 1. SFTP Connector Operations ## Configure a Global Element for the Connector When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to configure the SFTP server connection. To configure the global element for SFTP Connector, follow these steps: 1. Select the name of the connector in the Studio canvas. 2. Select the operation in the Studio canvas. 3. In the configuration screen for the operation, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. On the **General** tab, specify the connection information for the connector: 5. If you want EdDSA support, provide the EdDSA dependency by clicking **Configure** under the **Required Libraries** field. 6. Set the **Working Directory** as the root of every relative path used with this connector. If it’s not provided, the value defaults to the remote server. 7. Set the **Host** field to specify the SFTP server host, for example, `localhost` or `192.168.0.1`. 8. On the **Advanced** tab, optionally specify a timeout configuration and reconnection strategy. 9. Click **Test Connection** to confirm that Mule can connect with the specified server. 10. Click **OK**. The following screenshot shows the SFTP Connector **Global Element Configuration** window in Anypoint Studio: ![SFTP Connector Global Element Configuration](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-global-configuration-with-required-lib.png) Figure 2. SFTP Connector Global Element Configuration In the XML editor, the configuration `sftp:config` looks like this: ```xml ``` ## View the App Log To check for problems, you can view the app log as follows: - If you’re running the app from Anypoint Platform, the output is visible in the Anypoint Studio console window. - If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path is customized in the app’s log file (`log4j2.xml`), you can also view the app log in the default location `MULE_HOME/logs/.log`. ## See Also - [Introduction to Anypoint Connectors](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors) - [Using Anypoint Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio) - [SFTP Connector Reference](https://docs.mulesoft.com/sftp-connector/latest/sftp-documentation) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.5 --- # Write a File Using the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Write** operation that writes content into the given path on demand. ## Configure the Write Operation in Studio To add and configure the **Write** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Write** operation. 2. Drag the **Write** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Path** field to `output.csv` to set the path of the file to write. By default, the connector writes whatever is in the message payload. ![Write operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-write-operation-1.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Use Embedded DataWeave Transformations If you place a **Transform Message** component before the **Write** operation, the message payload changes, and that impacts the operation that is placed after the **Write** operation. Therefore, if the payload is in a different format and you need to transform it before writing it, you can place the transformation inside the **Content** field of the **Write** operation to generate content to be written without affecting the message in transit. The following example places the DataWeave transformation in the **Content** field: ![Write operation configuration in Studio with Content field](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-write-operation-2.png) In the **Configuration XML** editor, the configuration looks like this: ```xml #[%dw 2.0 output application/csv --- payload.customers.email ] ``` ## Write into Directories Because the **Write** operation fails by default if you set nonexistent directories in the **Path** field, set the **Create parent directories** field to **True (Default)** to automatically create any missing directories. The following example shows that if any of the `a`, `b`, or `c` directories set in the **Path** field do not exist, the connector creates them: ![.Write operation configuration with Create parent directories](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-write-operation-3.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## Use Write Strategy Use the **Write strategy** field to configure the strategy to write the file. You can configure the field to select either of these strategies: - `STANDARD` This is the default strategy that you can use in the `APPEND`, `OVERWRITE`, and `CREATE_NEW` modes. - `CUSTOM` This strategy enables you to manually specify the offset for the server to write the file in `APPEND` mode, particularly only for older SFTP servers that do not directly support write modes. Additionally, you can configure the buffer size for writing into the file via the **Buffer size for write strategy** field. > [!NOTE] Use the `CUSTOM` write strategy with the `CUSTOM_APPEND` mode because it isn’t applicable > to the `OVERWRITE` or `CREATE_NEW` modes. Use this strategy only if the `STANDARD` strategy > results in errors during file writing in `APPEND` mode. Concurrency isn’t maintained for servers > that don’t follow SFTP guidelines. The following example shows the configuration for both fields: ![Write operation configuration with write strategy and buffer size for write strategy fields](/mulesoft/current/en-us/sftp-connector/2.5/_images/sftp-write-operation-4.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## Write to Existing Files When writing content to a file, set the **Write Mode** field to any of the following modes: - **OVERWRITE (Default)** If the file exists, overwrite it completely. - **APPEND** If the file exists, add its content to the end of an existing file. - **CREATE\_NEW** Create a new file. If the file already exists, then you receive an error. ## Locks The **Write** operation supports locking similar to the **Read** operation. The main difference is that the lock releases automatically after the **Write** operation finishes. Set the **Lock** field to any of the following modes: - **TRUE** - **FALSE (Default)** ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.5/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.6 --- # Write a File Using the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Write** operation that writes content into the given path on demand. ## Configure the Write Operation in Studio To add and configure the **Write** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Write** operation. 2. Drag the **Write** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Path** field to `output.csv` to set the path of the file to write. By default, the connector writes whatever is in the message payload. ![Write operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-write-operation-1.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Use Embedded DataWeave Transformations If you place a **Transform Message** component before the **Write** operation, the message payload changes, and that impacts the operation that is placed after the **Write** operation. Therefore, if the payload is in a different format and you need to transform it before writing it, you can place the transformation inside the **Content** field of the **Write** operation to generate content to be written without affecting the message in transit. The following example places the DataWeave transformation in the **Content** field: ![Write operation configuration in Studio with Content field](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-write-operation-2.png) In the **Configuration XML** editor, the configuration looks like this: ```xml #[%dw 2.0 output application/csv --- payload.customers.email ] ``` ## Write into Directories Because the **Write** operation fails by default if you set nonexistent directories in the **Path** field, set the **Create parent directories** field to **True (Default)** to automatically create any missing directories. The following example shows that if any of the `a`, `b`, or `c` directories set in the **Path** field do not exist, the connector creates them: ![.Write operation configuration with Create parent directories](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-write-operation-3.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## Use Write Strategy Use the **Write strategy** field to configure the strategy to write the file. You can configure the field to select either of these strategies: - `STANDARD` This is the default strategy that you can use in the `APPEND`, `OVERWRITE`, and `CREATE_NEW` modes. - `CUSTOM` This strategy enables you to manually specify the offset for the server to write the file in `APPEND` mode, particularly only for older SFTP servers that do not directly support write modes. Additionally, you can configure the buffer size for writing into the file via the **Buffer size for write strategy** field. > [!NOTE] Use the `CUSTOM` write strategy with the `CUSTOM_APPEND` mode because it isn’t applicable > to the `OVERWRITE` or `CREATE_NEW` modes. Use this strategy only if the `STANDARD` strategy > results in errors during file writing in `APPEND` mode. Concurrency isn’t maintained for servers > that don’t follow SFTP guidelines. The following example shows the configuration for both fields: ![Write operation configuration with write strategy and buffer size for write strategy fields](/mulesoft/current/en-us/sftp-connector/2.6/_images/sftp-write-operation-4.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## Write to Existing Files When writing content to a file, set the **Write Mode** field to any of the following modes: - **OVERWRITE (Default)** If the file exists, overwrite it completely. - **APPEND** If the file exists, add its content to the end of an existing file. - **CREATE\_NEW** Create a new file. If the file already exists, then you receive an error. ## Locks The **Write** operation supports locking similar to the **Read** operation. The main difference is that the lock releases automatically after the **Write** operation finishes. Set the **Lock** field to any of the following modes: - **TRUE** - **FALSE (Default)** ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/2.6/sftp-examples) - [Salesforce Help](https://help.salesforce.com) --- product: SFTP Connector version: 2.7 is-latest-version: true --- # Write a File Using the SFTP Connector Example > For the full documentation index, see: https://docs.mulesoft.com/llms.txt Anypoint Connector for SFTP (SFTP Connector) provides a **Write** operation that writes content into the given path on demand. ## Configure the Write Operation in Studio To add and configure the **Write** operation in Studio, follow these steps: 1. In the **Mule Palette** view, search for `sftp` and select the **Write** operation. 2. Drag the **Write** operation onto the Studio canvas. 3. In the **General** tab of the operation configuration screen, click the plus sign (**+**) next to the **Connector configuration** field to access the global element configuration fields. 4. Specify the connection information and click **OK**. 5. In the **General** tab, set the **Path** field to `output.csv` to set the path of the file to write. By default, the connector writes whatever is in the message payload. ![Write operation configuration in Studio](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-write-operation-1.png) In the **Configuration XML** editor, the `` configuration looks like this: ```xml ``` ## Use Embedded DataWeave Transformations If you place a **Transform Message** component before the **Write** operation, the message payload changes, and that impacts the operation that is placed after the **Write** operation. Therefore, if the payload is in a different format and you need to transform it before writing it, you can place the transformation inside the **Content** field of the **Write** operation to generate content to be written without affecting the message in transit. The following example places the DataWeave transformation in the **Content** field: ![Write operation configuration in Studio with Content field](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-write-operation-2.png) In the **Configuration XML** editor, the configuration looks like this: ```xml #[%dw 2.0 output application/csv --- payload.customers.email ] ``` ## Write into Directories Because the **Write** operation fails by default if you set nonexistent directories in the **Path** field, set the **Create parent directories** field to **True (Default)** to automatically create any missing directories. The following example shows that if any of the `a`, `b`, or `c` directories set in the **Path** field do not exist, the connector creates them: ![.Write operation configuration with Create parent directories](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-write-operation-3.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## Use Write Strategy Use the **Write strategy** field to configure the strategy to write the file. You can configure the field to select either of these strategies: - `STANDARD` This is the default strategy that you can use in the `APPEND`, `OVERWRITE`, and `CREATE_NEW` modes. - `CUSTOM` This strategy enables you to manually specify the offset for the server to write the file in `APPEND` mode, particularly only for older SFTP servers that do not directly support write modes. Additionally, you can configure the buffer size for writing into the file via the **Buffer size for write strategy** field. > [!NOTE] Use the `CUSTOM` write strategy with the `CUSTOM_APPEND` mode because it isn’t applicable > to the `OVERWRITE` or `CREATE_NEW` modes. Use this strategy only if the `STANDARD` strategy > results in errors during file writing in `APPEND` mode. Concurrency isn’t maintained for servers > that don’t follow SFTP guidelines. The following example shows the configuration for both fields: ![Write operation configuration with write strategy and buffer size for write strategy fields](/mulesoft/current/en-us/sftp-connector/latest/_images/sftp-write-operation-4.png) In the **Configuration XML** editor, the configuration looks like this: ```xml ``` ## Write to Existing Files When writing content to a file, set the **Write Mode** field to any of the following modes: - **OVERWRITE (Default)** If the file exists, overwrite it completely. - **APPEND** If the file exists, add its content to the end of an existing file. - **CREATE\_NEW** Create a new file. If the file already exists, then you receive an error. ## Locks The **Write** operation supports locking similar to the **Read** operation. The main difference is that the lock releases automatically after the **Write** operation finishes. Set the **Lock** field to any of the following modes: - **TRUE** - **FALSE (Default)** ## See Also - [SFTP Connector Examples](https://docs.mulesoft.com/sftp-connector/latest/sftp-examples) - [Salesforce Help](https://help.salesforce.com)