Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I don't believe you are going to find a better way. Running perl is not automagically going to give you any root priviledges, and you'll still have to do some su'ing to the root level to make things work.

A much better solution (IMO) is to create a script that has the group suid set (that is "rwxrws---"), created by root, with the group containing only those people that you want to be able to run the script from their accounts. The suid bit allows programs that require access to root-level resources to temporarily gain them, and is typically used for direct interaction with the hardward (like X) or with the lower ports (like httpd). But since it has that power, you want to limit who can run it, particularly if you are on a shared-user box. This script can be done in perl, but based on what you have above, it can be as simple as this shell script

#!/bin/sh /www/apache/bin/apachectl start
Do note that you have to have your root user create this and set the bits and set up the group appropriately. A non-root user can't (or shouldn't, at least) be able to grant suid status to a file.

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important


In reply to Re: Executing Root Commands from user level by Masem
in thread Executing Root Commands from user level by curtisb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-19 06:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found