CGI-Shell Script runs ok in command prompt but not through the webpage

Discussion in 'Apache' started by rajib_145, May 18, 2012.

  1. #1
    Hi Linux Gods,I am a newbie and need your kind help.On my Linux machine i have installed apache and managed to run it as different user with administrative rights(adding the user to Wheel group), also with the help of this forum i was able to create the webpage and call cgi scripts. Now the problem is:The cgi shell script seems to be ok according to my best as it runs perfectly alright while running fron my shell, but it doesnot work from the website.By the way:The Script goes like this:#!/bin/bash#Taking the arguments from a html pagehost=`echo $QUERY_STRING | awk -F'=' '{ print $3 }'`user=`echo $QUERY_STRING | awk -F'[= &]' '{ print $2 }'`echo 'Content-type: text/html'echo ''echo ''entry="$user $host=ALL"if `sudo ssh "$hostname" "echo "$entry" >> /etc/sudoers"`thenecho "Sudo permission Given for $user on $host" > /pathelseecho "Sudo permission for $user on $host is not Successfull" > /pathfiecho ''echo ''I am really getting confused where i am getting wrong.
     
    rajib_145, May 18, 2012 IP
  2. Cheapvpsoffers

    Cheapvpsoffers Member

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #2
    Have you uploaded the script in cgi-bin folder?
     
    Cheapvpsoffers, May 22, 2012 IP