?
Solved

Connecting to a SSH Server

Posted on 2004-08-30
6
Medium Priority
?
1,096 Views
Last Modified: 2010-07-27
Hello Experts.
I have a Linux RedHat9 box running SSH Server on port 22.
Now, i want write a small apllication in Delphi 7 that allow me to connect to this SSH Server.

What i want to do:
 1- Connect from my Windows XP to my Linux on port 22.
 2- Make login
 3- Execute a shell script (myscript.sh)
 4-Exit

I don't want use programs like putty because it's not necessary!
Everything that i want to do, is open my Delphi Application, enter my username and password, and click a simple button.
So, my Delphi Application will connect to the remote host, run my script and Exit.

Thank's in Advanced.
0
Comment
Question by:Spetson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Accepted Solution

by:
DarkCore_ earned 1600 total points
ID: 11931584
In Delphi? Why don't do this as a cron task or a php/cgi in apache?

In Delphi you'll need a ssh-connection component ( I don't know about any free component ), parse text ... etc ... it will be so complicated.

If you have kylix you can do too a small server listening at any port which listens for a connection and recieves a packet ( a string ), then run the script, for example.

Edu
0
 

Author Comment

by:Spetson
ID: 11931827
huummm!
Ok, i will explain All my situation:
I will host a game server in my linux box...
Some members of my clan (game clan) don't know absolute nothing about ssh connection, telnet, etc...
So, i need something very simple for this guys...
a php or perl script sounds good, as my linux have Apache running at port 80, but i have already tested this option, without success...
The php script freeze's when start the script myscript.sh using exec() command or `myscript.sh`.

What the myscript.sh does:
1-Check if the game server is not running (avoid multiple instances), if it's running, kill it.
2-restart the application.

So, if you have some good idea, please let me know.

I Know that this topic area is about Delphi, but ANY SOLUTION for the Question will be very apreciate.

And...
About Kylix, i don't have this great program for linux :(
About cron task, the start/stop action, Must be interactive (user command) and not autamatic.

Thank's.
0
 
LVL 4

Expert Comment

by:Colin_Dawson
ID: 11931868
You might want to check out the indy components.  That will give you the connection over port 22.  The SSH bit I can't help you with though.

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:DarkCore_
ID: 11931992
in your script, try to run it with

   run_program &

to let it go to background.

In Apache the problem could be permissions. Be sure your apache ( with user Nobody ) have permissions to run your program. What kind of error does?

You can try too a simple sequence ... let the user install putty. Give them a 'standard' username and a password. In their .bashrc profile include some lines like

   ./myscript.sh &
   logout

Edu
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 11933040
you can use TIdRSH (from Indy). This is Unix Remote Shell component and you can execute the shell script...
0
 

Author Comment

by:Spetson
ID: 11940253
Ok guys!
It’s funny, but the found solution was not in Delphi, but using a php script that will do the entire job for me.
Thank you to DarkCore for all the support by email.
I decided to not post the solution here, as this Topic Area is about Delphi and not Php.
But anyways, if someone is interested in this question, please post your comments here and let us know.

Thank’s
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question