SSH client delphi open-source library or component, or alternatives
I need my Delphi application to issue very simple commands for example
ssh -l userid host.domain.com "df -h"
userid@host.domain.com's passwo开发者_Python百科rd: 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.
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.
精彩评论