Deutsch   English   Français   Italiano  
<101pd75$ojp1$30@dont-email.me>

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

Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: The Natural Philosopher <tnp@invalid.invalid>
Newsgroups: comp.os.linux.misc
Subject: Re: Simple way for web to execute root shell script.
Date: Wed, 4 Jun 2025 13:12:21 +0100
Organization: A little, after lunch
Lines: 34
Message-ID: <101pd75$ojp1$30@dont-email.me>
References: <100pphq$2taj$2@dont-email.me> <87ldq8x9ee.fsf@ezaquarii.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 04 Jun 2025 14:12:22 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="d04d294eabf7b6797c14978ccdcd9d20";
	logging-data="806689"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+udB7n4+UkdazythhyLpgVL5o7ZksmGY4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:L9n05Nfdfg0Z82Oq/bcbjihfUU4=
Content-Language: en-GB
In-Reply-To: <87ldq8x9ee.fsf@ezaquarii.com>

On 04/06/2025 08:18, Chris Narkiewicz wrote:
> 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.
> 
In the end  setting a passwordless sudo for the www-data user for that 
script only, worked and was the first method to do so, so I stopped there.


> 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.
> 
I have done that in the past.

> Another way is to call the script form cron and place the output
> in some location where apache can get it.
> 
I want very fast up to date response when I am on the web site and dont 
care when I am not, so that inclines towards a real time script.

> Best regards,
> Chris Narkiewicz

-- 
It is the folly of too many to mistake the echo of a London coffee-house 
for the voice of the kingdom.

Jonathan Swift