Author Topic: CGI help  (Read 702 times)

zahc

  • friend
  • Senior Member
  • ***
  • Posts: 5,801
CGI help
« on: July 26, 2012, 06:14:02 PM »
I want to write a program where

-the user chooses to upload a file (I have this working)
-the CGI program slices and dices the file (this works)
-the website then presents the resulting file-chunks to the user as html links (I'm stumped on this)

The problem I have is that the webserver runs as user 'nobody'. The cgi-bin directory and programs in it are world-executable, but apparently the output from the cgi script when the webserver is executing it inherits the 'nobody' privileges so the CGI program can't write output anywhere. I can create a world-writable directory, but that seems like a Bad Idea. Now I'm thinking about creating a world-writable directory outside the web document root, then creating a world-readable directory inside the web root that links to the world-writable one, and putting links to that in my output.

What is the actual correct thing to do?
Maybe a rare occurence, but then you only have to get murdered once to ruin your whole day.
--Tallpine

CNYCacher

  • friend
  • Senior Member
  • ***
  • Posts: 4,438
Re: CGI help
« Reply #1 on: July 27, 2012, 05:57:04 AM »
Make a directory in the web root that is owned by "nobody". Make the files go there.
On two occasions, I have been asked [by members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question.
Charles Babbage