beejayf
Posts: 35
Joined: Fri Aug 16, 2013 2:30 pm

Web-Interface to trigger shell-scripts

Tue Sep 17, 2013 7:00 am

Hey y'all!

I am currently looking for a way to start a number of shell-scripts on my raspberry pi from my smartphone. I guess one way to do this would be to host a website on my pi that contains maybe eight tiles that trigger e.g. shell-scripts when touched.

Does anybody know if there es a package that does that - or what I would need to do to implement such a functionality?

Thanks in advance!

User avatar
duberry
Posts: 379
Joined: Mon Jan 28, 2013 10:44 pm
Location: standing on a planet that's evolving. And revolving at nine hundred miles an hour

Re: Web-Interface to trigger shell-scripts

Tue Sep 17, 2013 9:07 am

hi!
to host a web site you will need a HTTP Daemon

its is then posible launch scripts/processes in a number of different ways
imo Common_Gateway_Interface is the easy way to do this

how you set this up depends on which httpd you use !

i think the most simple bare minimum to get a result is busybox httpd

that link: http://wiki.openwrt.org/doc/howto/http.httpd
has some examples showing busybox + cgi and shell scripts 8-)
lend me your arms, fast as thunderbolts, for a pillow on my journey.
If the environment was a bank, would it be too big to fail
so long; and thanks for all the pi

beejayf
Posts: 35
Joined: Fri Aug 16, 2013 2:30 pm

Re: Web-Interface to trigger shell-scripts

Tue Sep 17, 2013 7:34 pm

Thanks!! That sounds quite right!

I installed apache2 (for the sake of being at least a Little familiar with it) and tried some cgi (bash)-scripts.

Simple things work - but if I try to run something that requires some more privileges (like interacting with the hardware) this part of the script will not be executed. I understand that this is due to the security layers built around cgi. Now I am not sure how to get past these restrictions without compromising security.

Any ideas?

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Web-Interface to trigger shell-scripts

Wed Sep 18, 2013 9:54 am

Well, you'll either need to investigate how to use group permissions and group membership to work out how to selectively allow the cgi-user to run certain tasks; or maybe you could look at WebIOPi? https://code.google.com/p/webiopi/
(although that's using Python, rather than Bash scripts)

beejayf
Posts: 35
Joined: Fri Aug 16, 2013 2:30 pm

Re: Web-Interface to trigger shell-scripts

Tue Oct 01, 2013 1:23 pm

Thanks! I got it to work with specific sudo rights for the script

mickus
Posts: 3
Joined: Sun Nov 10, 2013 12:31 pm

Re: Web-Interface to trigger shell-scripts

Sun Nov 10, 2013 12:37 pm

I wanted to do the same and I have documented the process of getting it working.

Check it out on my blog
http://www.securitystudent.blogspot.com

Return to “Raspberry Pi OS”