I'm building a web dashboard for a temperature sensor. The page is served by node.js, and the sensor connected to GPIO is accessed by a Python script, which is run by node.js. Relevant code:
var execSync = require('child_process').execSync; var result = execSync('./sensor_scripts/current.py');
The problem is that I need root to access GPIO, but I don't want to run the node.js script as root, for obvious reasons.
What I tried, based on this answer:
sudo chown root current.py sudo chmod +s current.py
But it didn't work. Is it even possible to do what I want?