Sujet : Re: Simple way for web to execute root shell script.
De : * (at) *nospam* eli.users.panix.com (Eli the Bearded)
Groupes : comp.os.linux.misc comp.sys.raspberry-piDate : 23. May 2025, 17:46:10
Autres entêtes
Organisation : Some absurd concept
Message-ID : <eli$2505231246@qaz.wtf>
References : 1
User-Agent : Vectrex rn 2.1 (beta)
In comp.os.linux.misc, 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.
Its all inside a domestic firewall so security is not a huge issue.
What is the quickest and simplest solution to this?
My "quickest and simplest solution":
$ su
Password:
# sed -i -e 's,^www:.*,www:x:0:0:Apache:/var/www:/usr/sbin/nologin,' /etc/passwd
# apachectl restart
# ^D
$
YMMV.
Elijah
------
personally would run the script from cron and have Apache view results