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

    From Chris Narkiewicz@hello@ezaquarii.com to comp.os.linux.misc,comp.sys.raspberry-pi on Wed Jun 4 08:18:01 2025
    From Newsgroup: comp.sys.raspberry-pi

    The Natural Philosopher <tnp@invalid.invalid> writes:

    I have a shell script that monitors hardware stuff - it needs to run
    as root and be called by Apache as user www.

    doas /path/to/shell.sh
    or sudo.

    Things are going to be a bit more complicated if you're in chroot.
    A small C utility that wraps exec and provides suid should be ok.

    Another way is to call the script form cron and place the output
    in some location where apache can get it.

    Best regards,
    Chris Narkiewicz
    --- Synchronet 3.21a-Linux NewsLink 1.2