Connecting CBCloudDrive to an SFTP Server
Requirements: CBFSCloud
This article explains how to configure CBCloudDrive to connect to an SFTP server. For a general overview of how the component works, see Getting Started with the CBCloudDrive Component.
Getting Started
All that is required to get started is to set ConnectionType to ctSFTP. After that, you can build a connection string using the below parameters.
Connection Parameters
| Parameter | Description |
|---|---|
| RemoteRoot | The absolute path on the server to use as the root of the mounted drive (e.g., /home/user/files). |
| SSHHost | The hostname or IP address of the SSH server. |
| SSHPort | The port the SSH service is listening on. Defaults to 22. |
| SSHUser | The username for authentication. |
| SSHAuthMode | The authentication method. Set to PASSWORD (default) for password-based auth or PUBLICKEY for certificate-based auth. |
| SSHPassword | The password for authentication. Required when SSHAuthMode is PASSWORD. |
| SSHCertEncoded | The PEM/Base64-encoded private key certificate for public key authentication. Required when SSHAuthMode is PUBLICKEY. |
Authentication
To authenticate with a username and password, set SSHAuthMode to PASSWORD (or omit it, as this is the default) and provide SSHUser and SSHPassword.
drive.ConnectionType = CBCloudDriveConnectionTypes.ctSFTP;
drive.ConnectionString = "RemoteRoot=/home/user/files;SSHHost=sftp.example.com;"
+ "SSHUser=myuser;SSHPassword=mypassword;";
Public Key
To authenticate with a private key, set SSHAuthMode to PUBLICKEY and provide SSHUser and SSHCertEncoded with the PEM-encoded private key.
drive.ConnectionType = CBCloudDriveConnectionTypes.ctSFTP;
drive.ConnectionString = "RemoteRoot=/home/user/files;SSHHost=sftp.example.com;"
+ "SSHAuthMode=PUBLICKEY;SSHUser=myuser;SSHCertEncoded=MY-PEM-KEY;";
We appreciate your feedback. If you have any questions, comments, or suggestions about this article please contact our support team at support@callback.com.