LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-25-2004, 07:40 PM   #1
kitmui
LQ Newbie
 
Registered: Dec 2003
Location: Boston, MA
Posts: 3

Rep: Reputation: 0
Unhappy 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
 
Old 03-25-2004, 10:45 PM   #2
rmanocha
Member
 
Registered: Oct 2003
Location: Austin,TX
Distribution: Debian SID-->fully content-->Love APT,kernel 2.6.4
Posts: 327

Rep: Reputation: 30
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?
 
Old 04-21-2010, 02:46 PM   #3
sxkathu
LQ Newbie
 
Registered: Apr 2010
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by rmanocha View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
HELP:write a CGI program with shell script supermyself Programming 3 06-12-2005 03:10 PM
configuring a cgi shell script to run keeg Linux - Newbie 1 06-09-2005 01:45 PM
how to execute shell scripts from cgi script rajatgarg Linux - General 1 07-08-2004 01:39 PM
SSH in a CGI script michedlp Programming 7 04-16-2004 10:58 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration