Sponsored Content
Top Forums Shell Programming and Scripting Run system command in perl cgi Post 302299596 by polki on Friday 20th of March 2009 12:47:51 PM
Old 03-20-2009
Well, I would exclude a syntax error, since in the sudoers file is the following example:
Quote:
# Uncomment to allow members of group sudo to not need a password
# (Note that later entries override this, so you might need to move
# it further down)
# %sudo ALL=NOPASSWD: ALL
I first tried to add this line to just make the www-data user free of anything:
Quote:
www-data ALL=NOPASSWD: ALL
After that didn't work, I activated the example line in the file and made www-data member of the group sudo. That didn't work either...

Next try was setting a password for www-data. Still the password request, but at least now I was able to enter the password I set and got this line:
Quote:
Sorry, user www-data is not allowed to execute '/usr/bin/VBoxManage list vms' as vboxuser on Debian.localdomain.
Next try was to add the same entry for another user and try with that one. Same thing as with www-data. No difference at all.

Last point you proposed is of no use anymore, since it doesn't even work with passwords enabled.

But all your proposals made me do some steps that gave me some clues. Smilie At one point I got the message posted in the last quote which made me think. The sentence implies, that it's only a problem of sudoing to this specific account. I then took some further reading and thinking and came to the conclusion, that sudo is normally a tool to gain root access, not access to another user. But I found something interesting in the sudoers manpage. Added this line to the sudoers file:
Quote:
www-data ALL=(vboxuser) ALL
This line specifies that www-data can run any commands as the other user. This took me a step further since from now on I was able to run the command after I entered the password specified earlier on.
After reading the manpage some more, I even found out what had to be done to get rid of the password prompt:
Quote:
Defaults:www-data !authenticate
This line in the sudoers file made the deal.

But still, I'm stuck with a last problem. I can run commands as my desired user without entering a password, but the command fails with an errorcode that is somehow related to rights. I somehow got the feeling, that it needs to read some files it doesn't have the right permissions when run from sudo. I also checked by logging into the desired account and running the command and all performs well. Since I have the "ALL" statement in /etc/sudoers, the problem can't be another program that is called, it's got to be some file. Any ideas on how I could find out which file or get sudo grant the vboxuser privileges for everything to www-data?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl run system command

Can perl execute a system command similar to the C function System()? Thanks. Gregg (1 Reply)
Discussion started by: gdboling
1 Replies

2. 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

3. Shell Programming and Scripting

Run SCP in backgroung using Perl CGI

Hi I am Run Perl CGI Script. In which i am running SCP Command. But I want that command to be run into background and exit the script. But Still Web page waiting for Finish the script. I m doing like : system ("scp -r machinename:/path/to/file/for/copy/ /path/for/ destination/directory/ &");... (3 Replies)
Discussion started by: Navrattan Bansa
3 Replies

4. Web Development

problem with exporting vairable from one perl cgi to another perl cgi script while redirecting.

Can anyone tell me how to export a variable from one perl CGI script to another perl cgi script when using a redirect. Upon running the login.pl the user is prompted to enter user name and password. Upon entering the correct credentials (admin/admin) the user is redirected to welcome page. My... (3 Replies)
Discussion started by: Arun_Linux
3 Replies

5. Shell Programming and Scripting

Better way to run this perl command

i'm working with files that are huge in size. over 3GB. and i need to do a lot of pattern matching. I need a way to grep for what i want, using a tool that is available across most unix systems. i initially was gungho about grep, but not all capablities of grep are available on all OSes. so... (10 Replies)
Discussion started by: SkySmart
10 Replies

6. Shell Programming and Scripting

Perl cgi pages out of cgi-bin folder in WINDOWS

Hi team, I have a typical problem with cgi pages in apache webserver in WINDOWS I am able to execute(display) the pages that are saved in cgi-bin folder. But I am not able to execute the pages stored in htdocs or other folder other than cgi-bin folder. Could anyone please let me know how... (1 Reply)
Discussion started by: scriptscript
1 Replies

7. Shell Programming and Scripting

Perl CGI : unable to download the excel sheet from perl cgi page

Hi All, I have written an cgi perl script that displays an image(Excel image) and when clicked on that Image I need to download a excel sheet. I made sure that excel sheet exists in the folder with the given name but still I am not able to download the sheet. print "<center><table... (2 Replies)
Discussion started by: scriptscript
2 Replies

8. Shell Programming and Scripting

CGI Perl : while loop in CGI perl

Hi Team, I am trying to connect to database(succeeded ) and print the records on the browser using while loop. But the elements of array are not displayed instead while loop is displayed directly. Instead of the below I can embed html statements in print but I am looking for the below style as I... (1 Reply)
Discussion started by: scriptscript
1 Replies

9. Shell Programming and Scripting

Perl system() to run a script

Hello, I'm trying to run "csso" (minify css) in a CGI script from the web panel. That is not working: Returns error 0; my $cmd = qq`csso stylesheet.css > stylesheet.min.css`; system($cmd); But that is working: my $cmd = qq`echo 'blabla' > stylesheet.min.css`; system($cmd); I'm... (12 Replies)
Discussion started by: madispuk
12 Replies

10. Shell Programming and Scripting

Run command through html+cgi in bash

Hi everyone, I want to kill process through the web, so I create html page with single bottom that run kill command in shell script with CGI. Here is html code: <td><form METHOD="GET" action="http://IP:port/cgi_bin/script.cgi" > <input type="submit" value= "Submit" > <INPUT name="q"... (7 Replies)
Discussion started by: indeed_1
7 Replies
cachemgr.cgi(8) 					      System Manager's Manual						   cachemgr.cgi(8)

NAME
cachemgr.cgi - squid HTTP proxy manager interface SYNOPSIS
http://your.server/cgi-bin/cachemgr.cgi DESCRIPTION
The cache manager (cachemgr.cgi) is a CGI utility for displaying statistics about the Squid HTTP proxy process as it runs. The cache man- ager is a convenient way to manage the cache and view statistics without logging into the server. FILES
./cachemgr.conf @DEFAULT_CACHEMGR_CONFIG@ The access configuration file defining which Squid servers may be managed via this cachemgr.cgi program. Each line specifies a server:port followed by an optional description The server name may contain shell wildcard characters such as *, [] etc. A quick selection dropdown menu is automatically con- structed from the simple server names. Specifying :port is optional. If not specified then the default proxy port is assumed. :* or :any matches any port on the target server. SECURITY
cachemgr.cgi calls the requested server on the requested port using HTTP and returns a formatted version of the response. To avoid abuse it is recommended to configure your web server to restrict access to the cachemgr.cgi program. Configuration examples for many common web servers can be found in the Squid FAQ. SEE ALSO
squid(8) The Squid FAQ, Chapter 9 The Cache Manager Squid Web Proxy 3.1.20 cachemgr.cgi(8)
All times are GMT -4. The time now is 01:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy