Repository navigation
SFTP Storage
Robin Rodricks edited this page Jan 18, 2023
·
13 revisions
SFTP implementation is wrapping SSH.NET library. As this is an external library, you need to reference package first.
The provider respects folder structure of the remote SFTP share.
You can instantiate it either by using a simple helper method accepting the most basic parameters, like hostname, port, username and password, however for custom scenarios you can always construct your own instance of FtpClient from the FluentFTP library and pass it to FluentStorage to manage:
IBlobStorage storage = StorageFactory.Blobs.Sftp("myhost.com", "username", "password");
// With a custom port and a private key file
IBlobStorage storage = StorageFactory.Blobs.Sftp("myhost.com", 2222, "username", new PrivateKeyFile("filename"));
// With both password and public-key authentication as an example, real world scenarios may need extra customisations
var connectionInfo = new ConnectionInfo("sftp.foo.com", "guest", new PasswordAuthenticationMethod("guest", "pwd"), new PrivateKeyAuthenticationMethod("rsa.key"));
IBlobStorage storage = StorageFactory.Blobs.Sftp(connectionInfo);To create from connection string, first register the module when your program starts by calling StorageFactory.Modules.UseSftpStorage(); then use the following connections tring:
IBlobStorage storage = StorageFactory.Blobs.FromConnectionString("sftp://host=hostname;user=username;password=password");- AWS S3 Storage
- Azure Blob Storage
- Azure File Storage
- Azure Data Lake
- Azure Key Vault
- GCP Storage
- Cloudflare R2 Storage
- MinIO Storage
- DigitalOcean Spaces
- Wasabi Storage
- Backblaze B2 Storage
- Hetzner Storage
- Vultr Storage
- MongoDB GridFS Storage
- Alibaba OSS Storage
- FTP Storage
- SFTP Storage
- Git Repository Storage