Search code examples
webservercgilighttpdpicamera

Where to write data for web server www-data user


I have a web server on a Pi with a Pi Camera. The goal is to click a button on a web page and have the camera take a picture and save it through a script in /usr/lib/cgi-bin/. Then I want to retrieve all of the pictures via ftp. This works, but I don't think I set up the permissions well. I gave www-data write access to a folder in the pi user's home directory, so it can save the pictures.

While this works, it seems sloppy and insecure. Should I be saving the files in a different location? I would still need to access them via ftp.

Thanks for the help.


Solution

  • /var/lib/$progname is usually a good place to save data by (system) programs. You could also choose the webserver's directory, e.g. /var/www/... (depending on your configuration and version in place).