I have an apache httpd server running python code using django framework and mod_wsgi.
I my view.py 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 successfull.
Can anyone guide me on how to fix this problem?
Thanks in advance!!!
EDIT:
I found the answer in serverfault.com. Here it is for reference
apache2 runs under root, but it forks processes which run under ‘www-data’ group.
So create a directory where you want to create files/directories
sudo mkdir /srv/www/writable
Change the group
sudo chgrp www-data /srv/www/writable
Grant the group write access
sudo chmod g+w /srv/www/writable
And you are done. Now you can create any files/directories in this directory using a script run by apache2
I found the answer in serverfault.com. Here it is for reference
apache2 runs under root, but it forks processes which run under ‘www-data’ group. So create a directory where you want to create files/directories
sudo mkdir /srv/www/writable
Change the group
sudo chgrp www-data /srv/www/writable
Grant the group write access
sudo chmod g+w /srv/www/writable
And you are done. Now you can create any files/directories in this directory using a script run by apache2