LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 07-06-2004, 08:20 PM   #1
rajatgarg
Member
 
Registered: Oct 2003
Posts: 41

Rep: Reputation: 15
how to execute shell scripts from cgi script


hi all,

i have been cracking over this but without success,

i have a main CGI script (in perl), from which I will like to call other scripts written in C or perl to do some minor job and return the response
to main CGI.
like->


main.pl is executed and it calls dirlist.pl, fileattrib (executable of fileattrib.c).

when i do this, dirlist.pl or fileattrib doesnt seem to be called as necessary operations ar enot performed..

i am using these lines in main.pl to call the scripts:-

`dirlist.pl`;
`fileattrib`;

Any ideas ????

2) How to log the errors generated by cgi-scripts ???
3) If i need to give root access to some script by setting suid 7555 to that script, will it still be executed by apache or not. if not, then how to fix it???

thanks in advance,

regards,
rajat garg
 
Old 07-08-2004, 01:39 PM   #2
Donboy
Member
 
Registered: Aug 2003
Location: Little Rock, Arkansas
Distribution: RH, Fedora, Suse, AIX
Posts: 736

Rep: Reputation: 31
Try assigning the command output to a variable in the script...

$item1 = `dirlist.pl`;
$item2 = `fileattrib`;

You can add the -w flag to the first line of your script and it will output some useful info the error log. So the first line of your script should look like... /usr/bin/perl -w.

I strongly advise against using suid for a script that is accessible from the web. If an attacker finds out about the existance of this script, they can try to crash the script and take control of your box.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
execute shell-scripts at kde startup supersucker Linux - Newbie 10 10-28-2005 10:47 AM
Execute Shell Scripts on startup dragoroberto Linux - Software 9 02-28-2005 08:46 AM
Failed to execute cgi script in Apache!! baby_linu Linux - Newbie 4 06-30-2004 04:23 PM
Apache Config for users to execute CGI scripts CragStar Linux - General 9 01-20-2003 12:37 AM
Can't execute *.cgi scripts. BrianG Linux - General 1 04-11-2001 03:38 AM


All times are GMT -5. The time now is 09:40 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration