Reputation: 686
I have tried to set WSGIDaemonProcess user as root.Then I am getting error log as follows
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105] [Errno 13] Permission denied: '/var/www'
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105]
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105] The Python egg cache directory is currently set to:
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105]
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105] /var/www/.python-eggs
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105]
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105] Perhaps your account does not have write access to this directory? You can
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105] variable to point to an accessible directory.
[Fri May 02 04:48:47 2014] [error] [client 103.6.158.105]
My Django application is inside /home/user/app/
Can anyone help to run WSGI Daemon process as root. Thanks.
Upvotes: 0
Views: 5940
Reputation: 2439
i had the same problem in debian server so i solved it by setting user = www-data and group = www-data
www-data user dosen't have permission inside /root folder
Upvotes: 0
Reputation: 58563
You cannot make either Apache child worker processes or mod_wsgi daemon processes run as root. There are deliberate built in protections to the code for both to prevent you doing that and attempting to do so will cause an error and Apache will not start up.
If you are truly trying to set 'user=root' to WSGIDaemonProcess and aren't seeing the error message:
WSGI process blocked from running as root.
with Apache not starting, then that can only mean that the Apache parent process as a whole was never started as root in the first place, not that it would help you due to the root restrictions on execution of your code.
Instead, your Apache instance is being started as the user 'bangtest', which means there is absolutely no way at any time Apache would have privileges to change the owner to root, even if you hacked the Apache and mod_wsgi code to explicitly remove the restrictions which protect you from creating a huge security problem for yourself.
In short, you really do not want to run any web application as root as it is a huge security issue waiting to happen.
BTW, ignoring this unwise desire to run as root, the actual problem you are having with the Python egg cache is clearly documented in the mod_wsgi documentation.
Upvotes: 2