Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH client delphi open-source library or component, or alternatives

Tags:

ssh

delphi

I need my Delphi application to issue very simple commands for example

ssh -l userid host.domain.com "df -h"

[email protected]'s password: XXXXX

Filesystem            Size  Used Avail Use% Mounted on
/dev/sdd5             4.9G  1.7G  3.0G  36% /
/dev/sdc1             1.1G   75M  952M   8% /boot
/dev/sdd2             2.0G   44M  1.8G   3% /var/log

Can you recommend any freeware component or library? I've looked in Tory's pages and googled a bit but cannot find any.

I could also look for alternatives if any.

like image 776
PA. Avatar asked Jan 29 '10 12:01

PA.


1 Answers

You can install Cygwin's OpenSSH Client, then call it from your application and capture it's output.

Here is an example on how to capture the console output: http://delphi.about.com/cs/adptips2001/a/bltip0201_2.htm

Keep in mind, that when you are loggin in to an SSH server, the password is requested, in interactive mode (SSH Client will wait until you type the password), so you must configure automatic login, like it's explained here:

http://magicmonster.com/kb/net/ssh/auto_login.html

A little more complicated solution is to use Synapse Lib to connect to the server by using SSL, like this example:

http://www.amsoftwaredesign.com/downloads/synapse_ssh_test.zip

I posted an article in my blog, with a simple class to let you do what you want: http://leonardorame.blogspot.com/2010/01/synapse-based-ssh-client.html

Hope this helps.

like image 157
Leonardo M. Ramé Avatar answered Oct 19 '22 05:10

Leonardo M. Ramé