Question

I have a text file "data.txt", and based on input to an html form I want to display a single line from that file. My result is delivered by a CGI script which needs to access data.txt, but I don't want a user to be able to type in "data.txt" into their web browser and see the whole file. Is there a simple way to make "data.txt" readable by the CGI script but not accessible by loading it with the browser?

I'm using standard apache on ubuntu. I believe the suexec module can do this, but I'm hoping for a simpler solution just using fancy permissions, chowns, etc. Thanks-

Was it helpful?

Solution

Store your datafile outside of the webserver filetree (for apache, check the DocumentRoot).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top