Answer the question
In order to leave comments, you need to log in
How to safely implement work with Raspberry GPIO through the web interface?
There is a php script with buttons to turn on / off the relay, connected to the Raspberry by running a bash script. To work, you need to give the php script the right to run sudo. As far as I understand it is not safe. What is the best way to implement the function?
Answer the question
In order to leave comments, you need to log in
Two options, in my opinion:
1: Properly configure sudoers.conf so that it is possible to run only a bash script and that's it.
2: Instead of bash, write a python + flask program that is a local web server and pull the GPIO through it (I implemented it this way). This is copy-pasting a couple of dozen lines + unit file into autorun.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question