Bash scripts - CGI and ssh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Bash scripts - CGI and ssh
# 1  
Old 07-23-2016
Bash scripts - CGI and ssh

Hi Everyone,

I started looking at the possibility of making some of our bash scripts available through a web server using CGI and the simple ones works just fine. Now I need to execute remote commands using ssh but can't really get it to work. I got private keys all sorted. Must be ssh having issues handling stdin/stdout. Please any advise will be highly appreciated.

regards,

HA.....
# 2  
Old 07-23-2016
Hi ariza,

I suggest you create debugging output of your script, like this:

Code:
#!/bin/bash

function _debug { echo "$1" >>/tmp/yourlogfile.txt ; }

_debug "trying to run command ..."
some_command 2>>/tmp/yourlogfile.xt

The expected problem is that the environment of the webserver, where your script runs is different from your testing environment, which supposedly is a normal system user.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

CGI script using ssh

Hi Friends, I am using a cgi script which calls a shell script internally. Now, I want to change it with ssh (without password). Can you please help? Code:cat maininfo.cgi #!/usr/bin/perl -w use Net::Telnet (); use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser... (1 Reply)
Discussion started by: suresh3566
1 Replies

2. Programming

Not able to ssh to other server from CGI script

Hi All, I have designed a web tool in perl cgi in UNIX Solaris 10 platform. According to my cgi script (in server A) it should execute a script (in server B) using ssh key authentication, but it is not. And when I am trying to execute the command without cgi script, the script in server B... (4 Replies)
Discussion started by: ankit_talwar
4 Replies

3. Shell Programming and Scripting

isset() PHP function in cgi bash scripts

Hi! Some minutes ago I've posted a question related with sed regexps because I need to catch information sended with forms with GET action. This is the post: https://www.unix.com/shell-programming-scripting/127800-regular-expression-sed.html But now I have a new question. Does cgi scripts have... (0 Replies)
Discussion started by: GagleKas
0 Replies

4. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

5. Shell Programming and Scripting

How to execute remote ssh command - Perl and CGI

Hi, I am having nightmare issue-ing remote ssh command from a CGI perl script. It just won't run on debug message: It says permission denied. Can I even do this? as the apache server running under DAEMON account probably can't execute it? Is this the case of what's going on? Here is my... (3 Replies)
Discussion started by: Dabheeruz
3 Replies

6. Web Development

User authentication for some Perl CGI scripts

Hi, I am trying to create a web interface with Perl CGI with 2 pages. The content of these pages is dependent on the user accessing it. Thus, I need some kind of authentication to identify WHO is logging in but I DO NOT WANT to be restricting the pages to a few. What is the best way to prompt... (8 Replies)
Discussion started by: garric
8 Replies

7. UNIX for Dummies Questions & Answers

How to share CGI Scripts across UNIX web server?

Hi, is it possible to create a CGI folder somewhere on the server and allow all domains on that server be able to access the scripts? I tried a ScriptAlias addition in httpd.conf but still no luck. Would greatly appreciate any tips! Thanks. Linux version 2.4.20-021stab028.3.777-enterprise Plesk... (5 Replies)
Discussion started by: karlsworld
5 Replies

8. Shell Programming and Scripting

How to share CGI Scripts across UNIX web server?

Hi, is it possible to create a CGI folder somewhere on the server and allow all domains on that server be able to access the scripts? I tried a ScriptAlias addition in httpd.conf but still no luck. Would greatly appreciate any tips! Thanks. Linux version 2.4.20-021stab028.3.777-enterprise Plesk... (1 Reply)
Discussion started by: karlsworld
1 Replies

9. Programming

Perl CGI Scripts

I need to create a webserver to run Perl CGI Scripts. Anyone have any ideas or good links? Yes I know there are lovely programs out there, but I need to build one in C. Thanks! (1 Reply)
Discussion started by: cb.mark
1 Replies

10. UNIX for Dummies Questions & Answers

Help With CGI Scripts and .htaccess

Hi everyone, I need help with writing a script that does the following: a client/user goes onto my website, hits a link, it would pop up either 1. user name and password 2. password and directory name and then after they enter the required info, it would take them to their own folder. So... (6 Replies)
Discussion started by: crazycelicagts
6 Replies
Login or Register to Ask a Question