Deutsch   English   Français   Italiano  
<87ldq8x9ee.fsf@ezaquarii.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Chris Narkiewicz <hello@ezaquarii.com>
Newsgroups: comp.os.linux.misc,comp.sys.raspberry-pi
Subject: Re: Simple way for web to execute root shell script.
Followup-To: comp.os.linux.misc
Date: Wed, 04 Jun 2025 08:18:01 +0100
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <87ldq8x9ee.fsf@ezaquarii.com>
References: <100pphq$2taj$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Wed, 04 Jun 2025 09:18:26 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0e987ce2737a28d05c269f58cbc0c248";
	logging-data="731586"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18BJTtoPyR3xv7sAIBjQQoYOmF+6phefm8="
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:CGMrmMunO2/8l5ERtMqtOAAV6VI=
	sha1:5yt1nFSMby11/skDqzjGsZMYqr8=
X-Motto: Unix - live free() or die()
Bytes: 1528

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