Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

SFTP Storage

Robin Rodricks edited this page May 14, 2024 · 5 revisions

To use this, you need to reference NuGet package first, which wraps SSH.NET.

The provider respects folder structure of the remote SFTP share.

Connect to SFTP Server

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 SftpClient from the SSH.NET 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);

Connection Strings

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");
Clone this wiki locally
Morty Proxy This is a proxified and sanitized view of the page, visit original site.