Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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'm running a python script under mod_wsgi on apache. The script attempts to create some files under a directory. The path of that directory is defined by this variable named tmpdir in the script.

My script resides in /var/www/webpy-app/scriptname.py

When the value for tmpdir is : /home/myname/test then I get the following error in ssl_error_log: [Errno 13] Permission denied: '/home/myname/test'

However, when the value for tmpdir is: /var/www/webpy-app/static then everything works fine.

The permissions for both folders are:

drwxrwxrwx. 2 root    root       4096 Oct 12 19:08 static
drwxrwxrwx.  2 myname myname     4096 Oct 12 18:50 test

I start the httpd service as sudo service httpd start

Question

What can I do so that this pythong script running in apache using mod_wsgi can create files under /home/myname/test?

share|improve this question

Use mod_wsgi daemon mode and have the daemon process run as you.

The permissions issue is described in:

In short, by default your code runs as the Apache user and it will not have access to directories/files in home directories.

share|improve this answer

Your Answer

 
discard

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.