Is it possible to have a cgi script run arbitrary commands? For example have the script run "aumix -v+5" to increase the volume on the machine it's running on.
The idea is to have a web page on a web sever running on my linux box that I can use to control the volume, play/pause music, etc. Then I could use my phone to navigate to that page and sort of use it as a remote for the PC. The phone doesn't have wifi so I can't just use ssh to log into my comp and do it that way.
You will have to give permissions to the 'nobody' user for everything you want to run. This is dangerous. You can still use SSH if your phone has a client.
Name:
Anonymous2010-12-14 7:25
>>3
The clients for the phone say that it only works with wifi. And you are right. I set thttpd to run as myself and the perl script worked. But I know that isn't a good idea. What if I created another user and gave it the right permissions? Would that be an okay solution or would it still have the same security problems?
>>4
As long as the user is highly restricted, i.e. cannot run commands other than the ones you specified - or perhaps, some message system whereby the script can ask your user "do this command please" somehow. Both are quite complex.
Name:
Anonymous2010-12-14 7:59
>>3
Another question. thttpd used the user www-data which I assume is basically the same as nobody. But why is it that it can run programs like cat,echo,date, & mpc but not aumix? The permissions are the same for all of them. What is it about aumix the is different? Would the user www-data need to be part of the audio group?
>>7
Yeah. $ ls -alh /dev/mixer
crw-rw---- 1 root audio 14, 0 Dec 14 11:07 /dev/mixer
Name:
Anonymous2010-12-14 9:32
what would be the proper way to create the button to run the perl script when it is pressed? I don't know html and I've been looking online trying to figure it out. I've found lots of examples but none that work they way I would like.
>>13
The problem is that html is non-portable. GNU autoconf addresses these portability concerns in an elegant manner, and permits you to focus on the real programming problems instead of wasting your time porting your code to new and different platforms.
>>14
I once wrote a HTML→LaTeX compiler, but that is impractical for this situation.
Name:
Anonymous2010-12-14 13:34
OP, for simplicity, just make the button bring you to a page called "/yourscript.pl?action=play". The script should react accordingly when receiving the "action=play" param.
Name:
Anonymous2010-12-14 14:01
<?php
if (isset($_POST['action']) && $_POST['action'] == 'play')
exec('./a_prog');
>>19
I do use mpd. I didn't know it had a web interface. I look for some. But I would still like to do this since I would like to do more then just control the music.