0

I set up an apache2 server on my RPi zero and written cgi script that reads temperature from database and prints it onto a website. To update data in the database, I have a small python script which collects data from BMP180 sensor and writes it to the database (does it every 10 min by cron job).

Now, here comes the trouble: the script needs to have permission to read from /dev/i2c-1. I changed the ownership of this folder to www-data but the ownership is cancelled after each reboot. Is there a way to set the ownership permanently or execute this task in any other way? Doing chmod after every reboot seems like a very bad solution...

0
3

On Raspbian members of group i2c have access to the I2C devices.

If you are using Raspbian you could make www-data a member of the i2c group.

sudo adduser www-data i2c

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.