Jump to content
Stéphane Wierzbicki

SFTP client

Recommended Posts

Hello, 

 

Does Indy support SSH? I need to connect to an SFTP server. I don't need SFTP (FTP over SSH) as it is different than FTPS (FTP over SSL/TLS).

 

If so, is there simple example available? 

If not, is there any free library available? 

 

Thank you! 

Edited by Stéphane Wierzbicki

Share this post


Link to post

You can do it with Synapse in combination with cryptlib, or better libssh2.dll, for free.

 

There is some source out there (I think sftp_2000) for Delphi.

 

If you can't find it I could convert the example I have from FPC/Lazarus back to Delphi (will need some time for that).

 

 

Share this post


Link to post
On 9/14/2019 at 12:24 AM, Stéphane Wierzbicki said:

Does Indy support SSH?

No.

On 9/14/2019 at 12:24 AM, Stéphane Wierzbicki said:

I need to connect to an SFTP server. I don't need SFTP (FTP over SSH) as it is different than FTPS (FTP over SSL/TLS).

Well, now I'm confused.  You asked about SSH, then said you don't need SFTP (FTP over SSH).  So which do you actually need - SFTP (which Indy does not support) or FTPS (which Indy does support)?

Share this post


Link to post
On 9/14/2019 at 9:24 AM, Stéphane Wierzbicki said:

Hello, 

 

Does Indy support SSH? I need to connect to an SFTP server. I need SFTP (FTP over SSH) as it is different than FTPS (FTP over SSL/TLS).

 

If so, is there simple example available? 

If not, is there any free library available? 

 

Thank you! 

Sorry for the confusion @Remy LebeauI need to connect to an SFTP server! 

Edited by Stéphane Wierzbicki

Share this post


Link to post
On 9/14/2019 at 9:24 AM, Stéphane Wierzbicki said:

If not, is there any free library available?

Like I stated before, you can do it with Synapse (from Ararat) and libssh2.dll. There is a SimpleSFTP.pas in the demo-directory. But that one uses cryptlib.dll which isn't free distributable. But there are version which can also use libssh2.dll (which is free). I have one for FPC but not ported to Delphi.

 

There are also versions which use plain winsock in combination with libssh2.dll (no need for Synapse).

For example: https://github.com/pult/libssh2_delphi (and like others on github)

 

Using the searchwords libssh2 and delphi in Google will get you a lot of results too.

For the Synapse version you can just search for SimpleSFTP.pas and libssh2 and you can search for the latest working with libssh2.dll.

 

If you have any problems let us know.

 

  • Like 1
  • Thanks 1

Share this post


Link to post
7 hours ago, Fr0sT.Brutal said:

For Indy it should be relatively easy to write a IOHandler using SSH

Really? I know nothing about that, but Devart needed to create a whole set of classes for implementing ssh and sftp

Edited by edwinyzh

Share this post


Link to post
14 hours ago, edwinyzh said:

Really? I know nothing about that, but Devart needed to create a whole set of classes for implementing ssh and sftp

I know little about that as well so it's better to ask Remy

Share this post


Link to post
23 hours ago, Stéphane Wierzbicki said:

No criticism @Remy Lebeau but why SSH was never implemented into Indy? 

Once upon a time, Indy had a larger dev team, but I suppose no-one ever had the time or opportunity to implement SSH.  Not that it is a trivial protocol to implement, what with encryption and all.  Now I'm the only dev left, and I definitely don't have the time to do something that large-scale on my own.  I don't even have a working SChannel IOHandler working yet, and that is just using a few (albeit complicated) system APIs.  I suppose someone could write an IOHandler wrapper for libssh or similar library, though.

  • Like 1
  • Thanks 1

Share this post


Link to post
10 hours ago, Fr0sT.Brutal said:

Found SChannel IOHandler here

I heard about it before, but I didn't know it has any relationship  with SFTP or SSH...

Share this post


Link to post
7 hours ago, edwinyzh said:

I heard about it before, but I didn't know it has any relationship  with SFTP or SSH...

It doesn't but it shows that implementing your own IOHandler is not a rocket science...

Share this post


Link to post

Yes, it works (I was able to connect, upload and download files). Probably I would have to set file rights after upload (it was uploaded to linux server, file rights were set to 000). Paradox is, that customer prefers something with support, so I had to buy Devarts SecureBridge Standard...

Edited by Vandrovnik
  • Like 1

Share this post


Link to post

SFTP and SSH commands are natively supported by Windows 10 version 1803 and Windows 11 now.

 

You can use my Windows Command Prompt Pipeline to interface with the two commands without "bringing up" command.com terminal Window.

 

You'll have to build your own commands as I haven't created a interface with it yet.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×