• Re: Simple way for web to execute root shell script.

    From Michael Schwingen@21:1/5 to The Natural Philosopher on Thu May 29 09:04:29 2025
    On 2025-05-23, The Natural Philosopher <tnp@invalid.invalid> wrote:
    I have a shell script that monitors hardware stuff - it needs to run as
    root and be called by Apache as user www.

    Bookworm linux on a Pi4.

    https://github.com/OliveTin/OliveTin

    might be worth a look. I only had a short look and have no own experience
    yet.

    cu
    Michael
    --
    Some people have no respect of age unless it is bottled.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From The Natural Philosopher@21:1/5 to Michael Schwingen on Thu May 29 12:20:25 2025
    On 29/05/2025 10:04, Michael Schwingen wrote:
    On 2025-05-23, The Natural Philosopher <tnp@invalid.invalid> wrote:
    I have a shell script that monitors hardware stuff - it needs to run as
    root and be called by Apache as user www.

    Bookworm linux on a Pi4.

    https://github.com/OliveTin/OliveTin

    might be worth a look. I only had a short look and have no own experience yet.

    Intersting. In the end I added this to /etc/sudoers

    #allow www to access to hwinfo.sh
    www-data ALL = (ALL) NOPASSWD: /usr/local/scripts/hwinfo.sh

    and then invoking
    #!/bin/sh
    echo "content-type:text/html"
    echo
    sudo /usr/local/scripts/hwinfo.sh

    from a script in /usr/lib/cgi-bin...

    Apache and firefox seem happy enough and I can AJAX that from the
    browser to get uptodate info.



    --
    There is nothing a fleet of dispatchable nuclear power plants cannot do
    that cannot be done worse and more expensively and with higher carbon
    emissions and more adverse environmental impact by adding intermittent renewable energy.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)