121

Can anyone recommend a good SFTP library to use? Right now I'm looking at products such as SecureBlackbox, IPWorks SSH, WodSFTP, and Rebex SFTP. However, I have never used any SFTP library before so I'm not sure what I'm looking for.

If anyone has used these before, is there any reason why I should go with product "X" over "Y"?

Kiquenet
  • 14,494
  • 35
  • 148
  • 243
  • possible duplicate of [How do I upload a file to an SFTP server in C# / .NET?](http://stackoverflow.com/questions/86458/how-do-i-upload-a-file-to-an-sftp-server-in-c-sharp-net) – Jeroen K Feb 04 '14 at 13:02
  • Is there an SFTP library licensed under MIT ? – Yash Saraiya Feb 09 '16 at 08:45
  • You can check the detailed review for SFTP Component for NET http://www.thedownloadplanet.com/reviews/review-ultimate-sftp-component-for-net-premium-version-for-company-with-source-code-lifetime-subscription/ – alexanoid Jun 23 '18 at 07:23

8 Answers8

92

I've searched around and found that this fork of SharpSSH and SSH.NET are the most up to date and best maintained libraries for SFTP (not to be confused with FTPS) communication in .NET. SSH.NET is a clean .NET 4.0 implementation of the SFTP protocol, and I've used it in a couple of solutions with flying colors and great success.

The original SharpSsh seems to be dead and most other solutions either require installation of Windows executables or a bucketload of cash (or worse; both).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Asbjørn Ulsberg
  • 8,721
  • 3
  • 45
  • 61
  • 7
    I've also used SSH.NET (http://sshnet.codeplex.com/) and found it to be excellent. – Alex Dec 14 '12 at 18:38
  • 11
    I found SSH.NET to be buggy right off the bat. Checking for file/dir exists always returned true. The many open and upvoted issues in the issue list turned me off of the project. – Ronnie Overby May 24 '13 at 19:31
  • 1
    @RonnieOverby I looked for the issue you mentioned about file/dir exists, and the issue doesn't exist anymore. I wrote code to test SSH.NET and it works as expected. – Colin Oct 14 '15 at 16:06
  • 3
    Thank You, After comparing them SSH.NET seems to be cleaner and easier to use. I'll update my answer after I finish the project I'm using them in. Thank You, – Nour Lababidi Apr 01 '16 at 20:09
  • 2
    An update - SSH.NET hasn't been updated since 2017, and I am finding the library can no longer handle connecting to SFTP servers using modern ciphers. – Mike Oct 22 '19 at 05:45
  • What's the performance of SSH.NET? – MrCalvin May 20 '21 at 13:23
  • are it up to date? – xSx Sep 28 '21 at 11:40
  • 2
    @xSx, [SSH.NET](https://github.com/sshnet/SSH.NET) was last updated 21 days ago, so I'd say "yes" to that. – Asbjørn Ulsberg Sep 29 '21 at 10:38
  • 1
    The last release was Jan 2021; it doesn’t support latest algorithms hundreds of issues/comments without a reply so I would suggest the project is essentially dead now; which is a shame – Dan Mar 02 '23 at 09:39
59

We use WinSCP. Its free. Its not a lib, but has a well documented and full featured command line interface that you can use with Process.Start.

Update: with v.5.0, WinSCP has a .NET wrapper library to the scripting layer of WinSCP.

Jon Cage
  • 36,366
  • 38
  • 137
  • 215
Jim
  • 770
  • 5
  • 2
  • 1
    Looks pretty good to me: http://winscp.net/eng/docs/library#example – Jon Cage Jul 01 '13 at 14:55
  • 5
    I successfully used the WinSCP .NET assembly (winscpnet.dll), wrapper on WinSCP scripting interface. Yes, really, it is well documented. It has many examples. If you pass in incorrect parameters the wrapper throws an exception detailing what is wrong. It took me some trial and error to get the parameters right, no fault of WinSCP, just my confusion between ftps and sftp. Also, remember to copy WinSCP.exe to the application bin folder; or you can set Session.ExecutablePath before calling Session.Open(). – Edward Jul 11 '14 at 10:23
  • 1
    WinSCP is licensed under GPL. Is there anything that I can work with licensed under MIT ? – Yash Saraiya Feb 09 '16 at 09:03
  • 1
    @YashSaraiya [WinSCP .NET assembly is licensed under MPL 2.0](https://winscp.net/eng/docs/library#license), not GPL. – Martin Prikryl Jun 21 '16 at 12:19
  • 5
    No good, winscp is tied to .exe, which's dodgey for multi platform development. – Alwyn Nov 25 '19 at 20:47
  • But it has REALLY bad performance. In best case i get around 30MB/s using SCP, even lower using FSTP. Using SFTP with puTTY i get 80MB/s (but it doesn't have progress indication). Never tried SSH.NET but I would give it a try. – MrCalvin May 20 '21 at 13:19
  • WinSCP is a Windows application. It cannot run on Linux. https://winscp.net/forum/viewtopic.php?t=30596 – user8606929 Jul 28 '22 at 15:00
8

Check this out: http://www.tamirgal.com/home/dev.aspx?Item=sharpSsh

SharpSSH is a pure .NET implementation of the SSH2 client protocol suite. It provides an API for communication with SSH servers and can be integrated into any .NET application.

The library is a C# port of the JSch project from JCraft Inc. and is released under BSD style license.

SharpSSH allows you to read/write data and transfer files over SSH channels using an API similar to JSch's API. In addition, it provides some additional wrapper classes which offer even simpler abstraction for SSH communication.

SharpSSH project page at source forge: http://sourceforge.net/projects/sharpssh

GEOCHET
  • 21,119
  • 15
  • 74
  • 98
  • 10
    cool stuff, but hasn't updated since 2007, need smth for .net 4 – Johnny_D Apr 18 '12 at 11:01
  • 1
    See my answer for something that is updated and actively maintained. – Asbjørn Ulsberg Aug 01 '12 at 11:51
  • 10
    I used this library and do not recommend it. It worked, but it felt like an incomplete port: some features were missing in the top level classes (testing whether files existed IIRC), and I had to call methods on private fields in order to get them working; commented-out chunks of Java code left in the source; wrapper classes named after ones in the Java standard library; Java idioms throughout. I've used SSH.NET instead (as in @asbjornu's post) with great success. – Alex Dec 14 '12 at 18:44
7

We bought a Rebex File Transfer Pack, and all is fine. The API is easy, we haven't any problem with comunications, proxy servers etc...

But I havent chance to compare it with another SFTP/FTPS component.

TcKs
  • 25,849
  • 11
  • 66
  • 104
6

Bitvise has a great product called Tunnelier which can bridge FTP to SFTP. You could then use the standard FtpWebRequest in .NET.

http://www.bitvise.com/ftp-bridge

I am currently testing this for my own purposes and will update with my findings.

update

This idea is not ideal for unattended automation, unless you want to jump through hoops keeping the client connected as a service or something, which I accomplished by using NSSM.

I've tried CLI automation with various clients including bitvise and winscp.com. I've also tried these .net class libraries: Winscp, SSH.NET, SharpSSH, and the commercial SecureBlackBox SFTP client.

SecureBlackBox worked well, but it's very heavy-weight, can be quite expensive depending on the licensing, and I didn't agree so much with it's API.

Hands down, the best free sftp client for .NET development is winscp. I've written a few classes and extension methods to make working with it easier: Winscp.Extensions

Community
  • 1
  • 1
Ronnie Overby
  • 45,287
  • 73
  • 267
  • 346
4

I've been using Chilkat's native SFTP library ( http://www.chilkatsoft.com/ssh-sftp-component.asp ) for a couple of months now and it's working great. Been using it in a nightly job to download large files and do private key authentication. Only problem that I had was getting the 64bit version to work on windows server 2008, I needed to install vcredist_x64.exe ( http://www.microsoft.com/download/en/details.aspx?id=14632 ) on my server.

Rocklan
  • 7,888
  • 3
  • 34
  • 49
  • 3
    Chilkat is not 100% managed code. Its a native library wrapped in .NET. When we incorporated this library it broke the visual studio web designer because VS runs in 32-bit mode. We've had to create all these work arounds between dev and prod (which is in 64-bit) so it can use the right DLL, not fun. The work around requires the GAC to have both 32 and 64 bit DLL installed on target machines: http://www.chilkatforum.com/questions/114/64bit-could-not-load-file-or-assembly-chilkatdotnet4-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format – Chris Smith May 02 '16 at 23:25
0

I've used IP*Works SSH and it is great. Easy to setup and use. Plus, their support is top-notch when you run into questions or problems.

Briggs
  • 490
  • 1
  • 4
  • 10
0

For comprehensive SFTP support in .NET try edtFTPnet/PRO. It's been around a long time with support for many different SFTP servers.

We also sell an SFTP server for Windows, CompleteFTP, which is an inexpensive way to get support for SFTP on your Windows machine. Also has FTP and FTPS.

Bruce Blackshaw
  • 986
  • 1
  • 7
  • 10
  • I've used the edtFTPnet library for some time - works well but the documentation for the .net bindings isn't great. – Jon Cage Jul 01 '13 at 14:57