Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

Question about CGI scripts

Name: Anonymous 2010-12-14 6:33

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.

Name: Anonymous 2010-12-14 6:43

inb4 ``typical ubanto user''

OP look at what CGI is before asking stupid questions. You can write ``CGI scripts'' in any language you want.

Name: Anonymous 2010-12-14 6:49

>>2
Yes, but that's not the issue.

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: Anonymous 2010-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?

Name: Anonymous 2010-12-14 7:36

Name: Anonymous 2010-12-14 7:38

>>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: Anonymous 2010-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?

Name: Anonymous 2010-12-14 8:03

>>7
Yeah.
$ ls -alh /dev/mixer
crw-rw---- 1 root audio 14, 0 Dec 14 11:07 /dev/mixer

Name: Anonymous 2010-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.

Name: Anonymous 2010-12-14 9:36

>>9
You should probably use GNU autoconf for that. It has a --with-button option.

Name: Anonymous 2010-12-14 9:44

>>9
It's rare to see such precise, verbose and clear description problem.

Name: Anonymous 2010-12-14 9:44

*of a problem

Name: Anonymous 2010-12-14 9:47

>>10
What? Why would I use autoconfig? I just want to know the html code to make a button that calls a perl script.

Name: Anonymous 2010-12-14 9:54

>>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.

Name: Anonymous 2010-12-14 10:14

>>14
I once wrote a HTML→LaTeX compiler, but that is impractical for this situation.

Name: Anonymous 2010-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: Anonymous 2010-12-14 14:01

<?php
if (isset($_POST['action']) && $_POST['action'] == 'play')
exec('./a_prog');

Name: Anonymous 2010-12-14 14:23

>>17
code tags

Name: Anonymous 2010-12-14 14:33

>>1
Why don't you just use mpd with its web interface?

Name: Anonymous 2010-12-14 15:07

OP is an obvious troll.

Name: Anonymous 2010-12-14 16:17

>>16
How do I do that? I don't know html. I've just be copying example I've found on the web.

>>17
Is that php code to do what I want?

>>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.

Name: Anonymous 2010-12-14 17:04

>>21
well when you get it working be sure to post the code and your IP address here so we can help you test it

Name: Anonymous 2010-12-14 19:30

>>21
I was going to help you but then I noticed your disturbing lack of `sage'.

Name: Anonymous 2010-12-14 19:55

>>23
why would I sage my own thread?

Name: Anonymous 2010-12-14 20:12

>>24  
Why would you satisfy your own penis

Name: Anonymous 2010-12-14 20:27

>>24,25
Why wouldn't you two go back to /b/?

Name: Fuck off, !Ep8pui8Vw2 2010-12-14 21:14

>>26
Why won't you fuck off, ``faggot''?

Name: Anonymous 2010-12-15 5:40

>>25
Because penis satisfiability problem is NP-complete.

Name: Anonymous 2010-12-15 7:50

>>28
Did you mean: NP-hard

Name: Anonymous 2010-12-15 8:35

>>29
nice.

Name: Anonymous 2010-12-15 8:35

>>29
I lol'd.

Name: Anonymous 2010-12-15 12:20

>>30,31
Not this shit again.

Name: Anonymous 2010-12-15 13:05

>>32
nice.

Name: Anonymous 2010-12-15 13:05

>>32
I lol'd

Name: Anonymous 2010-12-15 13:54

>>33,34
Not this shit again.

Name: Anonymous 2010-12-15 14:02

>>36
nice.

Name: Anonymous 2010-12-15 14:02

>>37
I lol'd.

Name: Anonymous 2010-12-15 14:36

>>36,37
Not this shit again.

Name: Anonymous 2010-12-15 18:43

>>38
nice.

Name: Anonymous 2010-12-16 1:41

>>38
I lol'd.

Name: Anonymous 2010-12-16 4:45

>>39,40
This shit again.

Name: Anonymous 2010-12-16 14:19

>>41
nice.

Name: Anonymous 2010-12-16 14:20

>>41
I lol'd

Name: Anonymous 2011-01-31 20:19

<-- check em dubz

Name: Anonymous 2013-01-19 23:42

/prog/ will be spammed continuously until further notice. we apologize for any inconvenience this may cause.

Don't change these.
Name: Email:
Entire Thread Thread List