tags:

views:

282

answers:

2

I m working on a python version cgi script which needs to create img files (which will be shown on the web page) in cgi-bin folder.

But it fails with: [Wed Oct 28 16:13:51 2009] [error] [client ::1] OSError: [Errno 13] Permission denied: 'average/'

[Note] 'average/' is the folder that the cgi script is going to create first for saving those img files.

I tried giving a+x permission to the cgi script, but it failed still. This happens on both Win and Mac.

Btw, I m working with the default Apache configurations. I didn't change anything after the installation of Apache.

A: 

The error message is complaining about permissions for the folder average/ not the cgi file.

EDIT: So your python script (which runs on both Win and Mac) is responsible for creating the folder and the img files?

You definitely should check your script and the permissions on the parent folder in which average/ is to be created.

If it's not just a permissions problem, as the error message suggests, you'll need a Python expert.

pavium
Ya, the "average" folder needs to be created first to save img files. But it fails to be created.
Yinan
+3  A: 

You would have to give the web server user write permission to the cgi-bin folder. Usually the web server user is something like nobody and not in the same group as the owner of the folder, so that means making cgi-bin world-writable:

chmod a+rwx cgi-bin

(or, on Windows setting permissions on cgi-bin to give Everyone ‘Full Control’.)

This is a really bad idea. Now any user on your server, or any script that doesn't check its filenames properly, might create a file in the cgi-bin, where it will be interpreted by Apache as a CGI script and executed. This is a good way to get your server owned.

Run-time-written files should go in a separate ‘data’ folder, outside the cgi-bin (and preferably outside the web root, bound with an Alias), with Apache set to disallow any kind of script or htaccess from that folder. You can then set ‘data’ 777, or, possibly better, have it owned by the web server user instead.

bobince