I want to play a sound file on my server using PHP. The PHP script is called by Apache and runs under the user 'nobody', which has by default no access to the speakers. So I created a new user soundoutput
which is allowed do play sound and has read permissions for the sound files he should play.
If I'm logged in as root, I can play a sound file using echo password | sudo -Su soundoutput mpg321 '/path/to/sound.mp3'
. The problem is, that it doesn't work when I'm executing this command using PHP's system_exec
. I guess that user nobody isn't allowed to run sudo, but what can I do that he is allowed to do that?
Any help appreciated.
/etc/sudoers
), which I consider a security risk, maybe you should make the script run as the soundoutput user.