SETUID not executing the script as owner when executed via PHP script
0
votes
0
answers
145
views
I have a sh file (with setuid) that I want specific web users to be able to execute from an endpoint:
-rwsr-xr-x 1 root root 59 Sep 11 09:47 restart-workers.sh
The content of this file is simply:
#!/bin/bash
/usr/bin/supervisorctl restart laravel-worker:*
When I invoke this:
exec('/var/www/html/restart-workers.sh', $stdout, $status);
I always get a permission denied error which I expect as PHP-FPM and Nginx are both running as the
www-data
user, however, I am trying to add the SETUID to the script so when the file is executed, the owner of the file is used to execute the script. Am I invoking this wrong? The sudo
package is not installed.
> error: , [Errno 13] Permission denied: file: /usr/lib/python3/dist-packages/supervisor/xmlrpc.py line: 557
Asked by Jaquarh
(101 rep)
Sep 11, 2023, 09:56 AM