-1

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?

Omnipresent
  • 227
  • 2
  • 7
  • 13

1 Answers1

0

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.

Graham Dumpleton
  • 6,090
  • 2
  • 21
  • 19