LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   cgi shell script: ssh not working (https://www.linuxquestions.org/questions/programming-9/cgi-shell-script-ssh-not-working-162424/)

kitmui 03-25-2004 07:40 PM

cgi shell script: ssh not working
 
I'm writing my very first cgi shell script. The main purpose of this script is to execute remotely several scripts on several machines outside the server.

I was hoping to use ssh to launch these remote scripts when a user presses a button on my website. The cgi script looks something like....

#!/bin/sh
# Here's my first cgi script

echo "Content text/plain"
echo ""
....HTML language....
ssh user@remotebox1 "path/command"
ssh user@remotebox2 "path/command"
...HTML lang.....

However, nothing's happening. No error, nothing. Could someone with more experience please help me. Thanks
Kit

rmanocha 03-25-2004 10:45 PM

well first off...i would not use a bash program for a cgi script.you would be better off using perl.
second..it will not be as easy as u pressing a button and ssh "magically" working.
you will first have to setup key based authentication or ask the user for the password for the account and pass the command that password(i have no idea how to do this second step...i'm not sure if it can be done at all).
besides...dont u think it will be insecure to have a button on a page and then let people execute commands over ssh?

sxkathu 04-21-2010 02:46 PM

Quote:

Originally Posted by rmanocha (Post 839712)
well first off...i would not use a bash program for a cgi script.you would be better off using perl.
second..it will not be as easy as u pressing a button and ssh "magically" working.
you will first have to setup key based authentication or ask the user for the password for the account and pass the command that password(i have no idea how to do this second step...i'm not sure if it can be done at all).
besides...dont u think it will be insecure to have a button on a page and then let people execute commands over ssh?

I am also getting same issues....I am using CGI-Perl to execute command on remote machine. If I am running command "perl script" its working..It will go to remote server and exectute the script but If I am executing same file from website its not working...no errors no warnings nothing.....all other commands are working in scripts but SSH command is not working.


All times are GMT -5. The time now is 12:11 PM.