Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an Apache httpd server running Python code using the Django framework and mod_wsgi. In my I need to make a subprocess call to execute another Python file which in the process needs to create some directories.

However, I am getting OSERROR 13: Permission denied no matter where I try to create the directory.

Only creating a directory in /tmp is successful.

Can anyone guide me on how to fix this problem?

share|improve this question
Did you check which user your scripts are running as and that that user has permission to write to the directories that you're adding files to ? – Iain Jul 23 '12 at 7:05

Just a wild guess since I'm not a python dev myself, but your script is most likely running as the apache2 user (typically www-data on ubuntu/debian machines, you'll have to check on yours). If you make a directory writable for this user or group, you will be able to create the directory inside.

For example:

# creating the application dir
sudo mkdir /var/www/myapp

# creating the writable dir
sudo mkdir /var/www/myapp/writable

# change the group of this folder
sudo chgrp www-data /var/www/myapp/writable

# grant the group write access
sudo chmod g+w /var/www/myapp/writable
share|improve this answer
Thanks!!!... that worked – Amm Sokun Jul 23 '12 at 7:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.