tags:

views:

11

answers:

1

I have a Python script running on the default OSX webserver, stored in /Library/WebServer/CGI-Executables. That script spits out a list of files on a network drive using os.listdir.

If I just execute this from the terminal, it works as expected, but when I try to access it through a browser (computer.local/cgi-bin/test.py), I get a permissions error:

<type 'exceptions.OSError'>: [Errno 13] Permission denied: '/Volumes/code/code/_sendrender/queue/waiting'

Is there any way to give the script permission to access the network when accessed via CGI?

+1  A: 

I don't know much about the default osx webserver, but the webserver process is probably being run as some user, that user needs to be able to access those files. To find out who the user is you can use the ps command. Then depending on the configuration of the network shared drive, you can add this user to the users allowed to access this data.

iondiode
You're right, it's executing as _www. However, I'm not sure how to grant permission for that user to access the network drives.
Aaron
not sure either, might be a good idea to tag this question with osx, since it seems to be osx related
iondiode