I have a PHP script that calls
exec('supervisorctl status 2>&1', $output);, which runs as
www-data user (through Apache).
However this user does not have access to this command. I would like to allow permissions for
www-data only for this exact
supervisorctl status command. It outputs the running supervisor processes very nicely and I'd like to show that in my webinterface.
# Running `supervisorctl status` under any user except root: $ supervisorctl status error: <class 'socket.error'>, [Errno 13] Permission denied: file: /usr/lib/python2.7/socket.py line: 228
I've tried adding this part to the
/etc/sudoers file (using
visudo) but it results in the same error (I possibly need more permissions since the error refers to python?) :
# /etc/sudoers Cmnd_Alias SUPERVISOR_STATUS = /usr/bin/supervisorctl status www-data ALL=(ALL) NOPASSWD: SUPERVISOR_STATUS