[SOLVED] CGI-Shell Script runs ok in command prompt but not through the webpage
Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
CGI-Shell Script runs ok in command prompt but not through the webpage
Hi Linux Gods,
I am a newbie and need your kind help.
On my Linux machine i have installed apache and was successfull in completing the initial steps like, 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 knowledge 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 page
host=`echo $QUERY_STRING | awk -F'=' '{ print $3 }'`
user=`echo $QUERY_STRING | awk -F'[= &]' '{ print $2 }'`
if `sudo ssh "$hostname" "echo "$entry" >> /etc/sudoers"`
then
echo "Sudo permission Given for $user on $host" > /path
else
echo "Sudo permission for $user on $host is not Successfull" > /path
fi
echo '</body>'
echo '</html>'
I am really getting confused where i am getting wrong.
Last edited by rajib_145; 05-18-2012 at 02:17 AM.
Reason: bad english
Kindly let me know for any other information, I really need to know this as i have gone a long distance and just because of this problem, i am stuck in the middle of sea. Please help me!!!!
And in the below path:
/var/www/error
there are many files with .var extension.
Iam sorry im really new to this, kindly accept my appology if i am not able to provide you any information which is very simple for others.
if `sudo ssh wipwab59 "echo "$entry" >> /etc/sudoers"`
then
echo "Sudo permission Given for $user on $host" > /local/administrativescripts/reports/sudo
else
echo "Sudo permission for $user on $host is not Successfull" > /local/administrativescripts/reports/sudo
fi
sudo ssh wipwab59 "echo "$entry" >> /etc/sudoers" ++ sudo ssh wipwab59 'echo user' 'wipwab59=ALL >> /etc/sudoers' sudo: sorry, you must have a tty to run sudo + echo 'Sudo permission for user on wipwab59 is not Successfull'
_________________________________
Happy with solution ... mark as SOLVED
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.