We help IT Professionals succeed at work.

Sftp Connection in Delphi

Oppital
Oppital asked
on
Comment
Watch Question

Commented:
How about indy ftp component?

with IdFTP1 do begin

  Host := Edit1.Text; // host
  User := Edit2.Text; // username
  Password := Edit3.Text; // password
  Connect; // make a connection
  TransferType := ftBinary; // or ftASCII
  // Upload a file
  Put(UploadOpenDialog1.FileName, ExtractFileName(UploadOpenDialog1.FileName));

  // or

 //Download a file
 // Get(Name, SaveDialog1.FileName, true);

  Quit; // close the connection

end;

Commented:
If you want to connect anonymously;

IdFTP1.ProxySettings.ProxyType := fpcmNone;
IdFTP1.User := 'anonymous';
IdFTP1.Password := 'test@test.com';
IdFTP1.Connect(true, 500);

Author

Commented:
@maosalah

Thanks for the example but I'm looking for a free solution, unpaid

Author

Commented:
@systan

This is an example of common FTP connection, I'm looking for SFTP

thanks

Commented:
Correct me if I'm wrong;

The only diference between ftp and sftp is there encryptions

If you want to create your own sftp connections, you should create sftp server and client

For sftp client;  encypt your user and password before sending it.
For sftp server;   user and password recieved shall be decrypted before comparing to the users database.

A sample code would be nice, but its time consuming because we have to start from the scratch.

If you have started doing it, you can submit your codea here, and let us discuss some changes of the code.

Lets share ideas by code snippet.

Author

Commented:
I believe there are more differences

because the companies charge expensive encryption tools, must have something more, would be very simple to encrypt and send
Commented:
Thank you for correcting, but there is a solution for that;

There is no such Sftp, they name it Sftp because it is a secured protocol connection.

Indy10 FTP has added Security Options that make's ftp SFTP, if you will use indyFtp and not using the security options, that makes your protocol connection FTP only.

By using the security options, that make's Secure as the name Sftp.

To all experts and to you, Correct me if I'm wrong again.
sftpimage.JPG

Commented:
Comments are good, please;
Commented:
@systan

Hi, basically Your right, but to get secure connection on INDY FTP You have to add IdServerIOHandlerSSLOpenSSL to IOHandler and make Your own certificate files with private and public keys...

I don't know how to make this certificates, I belive that Google should help...

Clipboard01.png

Author

Commented:
@systan thanks for the tip, is helping a lot

@NevTon thank you for explaining ssl

could please send me a practical example

Commented:
>>You have to add IdServerIOHandlerSSLOpenSSL
Yes, I'm not done with that part, but you have it.

>>could please send me a practical example
Oh men, your just like me, always want a sample, lol, tired of thinking... ?
Anyway, if I have time to program basically of what you want, I will.


@Nevton, thanks for the good approach.

Commented:
What version of delphi you have?

Author

Commented:
I am extremely pleased with the help of you two, thanks, I'm a fan of you now

Author

Commented:
Perfect no more doubts

Commented:
The demo of indy10 SFTP;
http://www.mediafire.com/?nzmteymmoin

Thanks