Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.