Forum
[PROBLEM] Apache as root on 1 file (visudo) - Printable Version

+- Forum (http://forum.xbian.org)
+-- Forum: Software (/forum-6.html)
+--- Forum: Testing & Experimental (/forum-21.html)
+--- Thread: [PROBLEM] Apache as root on 1 file (visudo) (/thread-2060.html)

Pages: 1 2


Apache as root on 1 file (visudo) - lukeg01 - 27th Jan, 2014 03:09 AM

hello,
i got a problem
i need apache to have acces to 2 scripts ( /home/xbian/lights/elro & /home/xbian/lights/action {there is a duplicate in /home/xbian/wiringPi/examples/lights})
when adding this to the visudo file
www-data ALL=(ALL) NOPASSWD: /home/xbian/wiringPi/examples/lights/./
it doesn't work, it can't run the scripts, so i tryed:
www-data ALL=(ALL) NOPASSWD: /home/xbian/wiringPi/examples/lights/
now im on : www-data ALL=NOPASSWD: ALL
and still doesn't work

i prefer the link to the file sinds it is more safe but can't get it to work...

luke


RE: Apache as root on 1 file (visudo) - CurlyMo - 27th Jan, 2014 04:57 AM

Just use pilight Smile


RE: Apache as root on 1 file (visudo) - lukeg01 - 27th Jan, 2014 05:02 AM

(27th Jan, 2014 04:57 AM)CurlyMo Wrote:  Just use pilight Smile

Is there a list of brands pi light works with ?
And how does it posts command from web interface, that way I can include it in my web app
Can I switch lights from terminal this way?

Luke


Re: Apache as root on 1 file (visudo) - CurlyMo - 27th Jan, 2014 06:18 AM

Did you even took the effort to check the pilight website? ConfusedConfused


RE: Apache as root on 1 file (visudo) - lukeg01 - 27th Jan, 2014 03:10 PM

(27th Jan, 2014 06:18 AM)CurlyMo Wrote:  Did you even took the effort to check the pilight website? ConfusedConfused
Yes, but didn' find it


RE: Apache as root on 1 file (visudo) - CurlyMo - 27th Jan, 2014 07:51 PM

- The list of brands can be found on the main page on the right. Can't be clearer.
- The last blog post is about the webinterface.
- The frontpage message is all about what pilight is (including it's webinterface).
- The second to last blog post is about how to switch lights from the command line.

You can't be serious when you say you took some effort.


RE: Apache as root on 1 file (visudo) - mk01 - 3rd Feb, 2014 12:23 PM

@lukeg01

www-data ALL= NOPASSWD: /home/xbian/wiringPi/examples/lights

and command to run it (issued by apache) needs to be : "sudo /home/xbian/wiringPi/examples/lights"


RE: Apache as root on 1 file (visudo) - lukeg01 - 5th Feb, 2014 06:38 AM

(3rd Feb, 2014 12:23 PM)mk01 Wrote:  @lukeg01

www-data ALL= NOPASSWD: /home/xbian/wiringPi/examples/lights

and command to run it (issued by apache) needs to be : "sudo /home/xbian/wiringPi/examples/lights"

Still doesn't work... Take a look at my PHP page, I think it goes wrong there

PHP Code:
<?php
if ( isset($_POST['button']) ) {
shell_exec('sudo /home/xbian/wiringPi/examples/lights/elro '.$_POST["button"].'');
}
?>

<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>

    <!-- Basic Page Needs
  ================================================== -->
    <meta charset="utf-8">
    <title>Licau</title>
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Mobile Specific Metas
  ================================================== -->
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <!-- CSS
  ================================================== -->
    <link rel="stylesheet" href="stylesheets/base.css">
    <link rel="stylesheet" href="stylesheets/skeleton.css">
    <link rel="stylesheet" href="stylesheets/layout.css">

    <!--[if lt IE 9]>
        <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

    <!-- Favicons
    ================================================== -->
    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="apple-touch-icon" href="images/light.png">
    <link rel="apple-touch-icon" sizes="72x72" href="images/light.png">
    <link rel="apple-touch-icon" sizes="114x114" href="images/light.png">

</head>
<body>



    <!-- Primary Page Layout
    ================================================== -->

    <!-- Delete everything in this .container and get started on your own site! -->

    <div class="container">
        <div class="sixteen columns">
            <h1 class="remove-bottom" style="margin-top: 40px"><img src="./images/light.png"> Licau</h1>
            <h5>Version 0.1</h5>
            <hr/>
                <h3>Beneden</h3>
                         <legend>Woonkamer</legend>
                          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                             <button class="button" type="submit" name="button" value="22 C on" />aan</button>
                             <button class="button" type="submit" name="button" value="22 C off" />uit</button>
                          </form>
            <hr/>
            
                <h3>Boven</h3>
                         <legend>Hal</legend>
                          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                             <button class="button" type="submit" name="button" value="22 A on" />aan</button>
                             <button class="button" type="submit" name="button" value="22 A off" />uit</button>
                          </form>
                          
                         <legend>Elektrische Deken</legend>
                          <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
                             <button class="button" type="submit" name="button" value="22 C on" />aan</button>
                             <button class="button" type="submit" name="button" value="22 C off" />uit</button>
                          </form>
            <hr/>
        </div>
        

    </div><!-- container -->


<!-- End Document
================================================== -->
</body>
</html> 

What I use in terminal= /home/xbian/wiringPi/examples/lights/elro 22 A on


RE: Apache as root on 1 file (visudo) - CurlyMo - 5th Feb, 2014 06:57 AM

@mk01, shouldn't you be promoting pilight as a favor Wink
@lukeg01, still didn't hear from you why pilight doesn't suit your needs.


RE: Apache as root on 1 file (visudo) - lukeg01 - 5th Feb, 2014 07:10 AM

(5th Feb, 2014 06:57 AM)CurlyMo Wrote:  @mk01, shouldn't you be promoting pilight as a favor Wink
@lukeg01, still didn't hear from you why pilight doesn't suit your needs.


It doesn't work with my sender, I want I system I understand at least a bit, pilight is a bit hard for me


RE: Apache as root on 1 file (visudo) - CurlyMo - 5th Feb, 2014 07:26 AM

I never heard any user that had sender problems? It's wierd that you want a system you understand but i only read questions here on how to get it to work Wink

Did you read the tutorials?
http://www.pilight.org/post/controlling-radio-outlets


RE: Apache as root on 1 file (visudo) - lukeg01 - 5th Feb, 2014 07:32 AM

(5th Feb, 2014 07:26 AM)CurlyMo Wrote:  I never heard any user that had sender problems? It's wierd that you want a system you understand but i only read questions here on how to get it to work Wink

Did you read the tutorials?
http://www.pilight.org/post/controlling-radio-outlets

I found it @ the Dutch Tweakers

http://gathering.tweakers.net/forum/list_messages/1556119

Says it written by you?


RE: Apache as root on 1 file (visudo) - CurlyMo - 5th Feb, 2014 08:09 AM

Who me? Wink


RE: Apache as root on 1 file (visudo) - lukeg01 - 5th Feb, 2014 08:12 AM

(5th Feb, 2014 08:09 AM)CurlyMo Wrote:  Who me? Wink

Looks like it to me,
But does work with the sender i got
And in a LPF really needed? I'm using it without now and it works


RE: Apache as root on 1 file (visudo) - CurlyMo - 5th Feb, 2014 08:31 AM

A new LPF will be released soon, so be patient and follow the tweakers topic.