Recent

Author Topic: Free SFTP client code for Mac?  (Read 5316 times)

AnthonyTekatch

  • Jr. Member
  • **
  • Posts: 78
Free SFTP client code for Mac?
« on: December 31, 2021, 12:56:48 am »
Is there a free SFTP client code/example that can be used in Lazarus/Freepascal on a Mac?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Free SFTP client code for Mac?
« Reply #1 on: December 31, 2021, 02:15:32 am »
Apple does not have an API for either FTPS or SFTP, although on macOS you may be able to make some headway by invoking the sftp command-line tool.

AnthonyTekatch

  • Jr. Member
  • **
  • Posts: 78
Re: Free SFTP client code for Mac?
« Reply #2 on: December 31, 2021, 03:25:28 am »
Apple does not have an API for either FTPS or SFTP, although on macOS you may be able to make some headway by invoking the sftp command-line tool.

I did get the command line running with Runncommand using the keygen password-free method, but in this case I need to sign into a server that I do not have the ssh key for and pass along the password to sftp. And, I read that it is frowned upon to be sending text passwords on the command line.

I suppose I can use the TProcess method for sending the password when asked.

PierceNg

  • Sr. Member
  • ****
  • Posts: 373
    • SamadhiWeb
Re: Free SFTP client code for Mac?
« Reply #3 on: December 31, 2021, 03:40:20 am »
Is there a free SFTP client code/example that can be used in Lazarus/Freepascal on a Mac?

Github lists three Delphi wrappers for libssh2. Not clear whether they work with FPC but good for reference if you are handy with FPC FFI.
libssh2 is known to work on MacOS.

AnthonyTekatch

  • Jr. Member
  • **
  • Posts: 78
Re: Free SFTP client code for Mac?
« Reply #4 on: January 02, 2022, 03:00:21 am »
Github lists three Delphi wrappers for libssh2. Not clear whether they work with FPC but good for reference if you are handy with FPC FFI.
libssh2 is known to work on MacOS.

Thank you for your suggestion.  I'm not handy with FPC FFI, but I'll read about it anyway.

rvk

  • Hero Member
  • *****
  • Posts: 6162
Re: Free SFTP client code for Mac?
« Reply #5 on: January 02, 2022, 04:39:51 pm »
If you can get LibSSH2 for the mac working (like PierceNg mentioned) you can start by looking at SimpleSFTP.pas from http://synapse.ararat.cz/files/contrib/ (download sftp.zip there). The 'problem' is that that one is using CryptLib (which isn't freely distributable).

I've got a working example (attached) with SimpleSFTP.pas for libssh2.dll.
I Tested it under Windows with test.rebex.net port 22.
There are other SFTP test-sites for clients here: https://www.sftp.net/public-online-sftp-servers

AnthonyTekatch

  • Jr. Member
  • **
  • Posts: 78
Re: Free SFTP client code for Mac?
« Reply #6 on: January 11, 2022, 05:00:50 pm »
Thanks for your help, I will dig into that later.

I took the easy way out for now and got expect to do the sftp password entry on Linux and a Mac:
https://forum.lazarus.freepascal.org/index.php/topic,7610.msg430509.html#msg430509

 

TinyPortal © 2005-2018