Curiosus.SFTP.SSH.NET
2.1.0
dotnet add package Curiosus.SFTP.SSH.NET --version 2.1.0
NuGet\Install-Package Curiosus.SFTP.SSH.NET -Version 2.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Curiosus.SFTP.SSH.NET" Version="2.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Curiosus.SFTP.SSH.NET" Version="2.1.0" />
<PackageReference Include="Curiosus.SFTP.SSH.NET" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Curiosus.SFTP.SSH.NET --version 2.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Curiosus.SFTP.SSH.NET, 2.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Curiosus.SFTP.SSH.NET@2.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Curiosus.SFTP.SSH.NET&version=2.1.0
#tool nuget:?package=Curiosus.SFTP.SSH.NET&version=2.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Curiosus.SFTP.SSH.NET
Implementation of Curiosus.SFTP ISftpClient based on
SSH.NET, with password or private key authentication and Polly retries.
Installation
dotnet add package Curiosus.SFTP.SSH.NET
Usage
Configure SftpClientOptions (either SshPassword or SshPrivateKeyPath is required):
Sftp:
SshServer: sftp.example.com
SshPort: 22
SshLogin: user
SshPrivateKeyPath: /secrets/id_rsa
RetryCount: 3
RetryTimeoutSec: 5
CheckOnStart: true
using Curiosus.SFTP;
using Curiosus.SFTP.SSH.Net;
using Curiosus.Tools.TempFiles;
var sftpOptions = configuration.GetSection("Sftp").Get<SftpClientOptions>()!;
// SftpClient needs ITempFileStreamFactory from Curiosus.Tools
services.AddTempFileServices(new TempFileOptions());
services.AddSftpServices(sftpOptions);
using var client = sftpClientFactory.GetSftpClient();
await client.UploadFileToServerAsync(stream, "/upload", "data/report.csv");
await using var file = await client.DownloadFileFromServerAsync("/upload", "data/report.csv");
AddSftpServices registers the options, ISftpClientFactory and an app initializer (IAppInitializer, executed
by Curiosus.Hosting on start) that checks the connection when CheckOnStart is true.
Notes:
SshPorthas no default value, set it explicitly (usually22).- If both a password and a private key are configured, password authentication is used.
- Missing parent directories are created on upload. If a file with the same size already exists, the upload is
skipped; if the size differs, it is replaced only when
overwriteistrue, otherwise an exception is thrown. - The namespace is
Curiosus.SFTP.SSH.Net.
See also
- Curiosus.SFTP — SFTP abstractions and options
- Curiosus.Tools — temp files and app initializers
- Curiosus.Utils — all packages
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Curiosus.SFTP (>= 2.0.0)
- Curiosus.Tools (>= 2.1.0)
- Polly (>= 8.0.0)
- SSH.NET (>= 2026.0.0)
-
net9.0
- Curiosus.SFTP (>= 2.0.0)
- Curiosus.Tools (>= 2.1.0)
- Polly (>= 8.0.0)
- SSH.NET (>= 2026.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.