Saturday, December 1, 2012

Re: Django apache mod_wsgi permission denied

Thanks a million for the tip :)

On Sun, Dec 2, 2012 at 5:08 AM, Chris Cogdon <chris@cogdon.org> wrote:


On Saturday, December 1, 2012 3:47:39 AM UTC-8, Loai Ghoraba wrote:
no I mean the root of my project guys :) thanks a lot :D which lives in path/to/my/project :)

Oh thank god for that!

I'd actually done something similiar once... I'd removed a bunch of permissions using chmod -R /   rather than chmod -R . ... This was on an oldold NCR Tower 32 running SVR3. I ended up writing a program to go through the archives on tape (yes, tape) and copy only the permission bits from all the tape files.

Anyway, a better form of that command is chmod -R a+rX

The capital X means "only set the execute bit if any execute bits are set". If you use lower-case x, then you'll send up setting the execute bit for normal files, too, which is another potential security risk. If you want to fix this up, do:

find . -type f -print0 | xargs -0 chmod a-x
chmod a+x manage.py # Restore x for the Django management command

Protip: always use the -print0 | xargs -0  form of the "find/xargs" pattern, as this will prevent spaces in your paths from causing havoc.

I wish I knew of a better way to set the x bits all the way up the tree, without giving someone a program to run, the best I can come up with is:

cd static
chmod a+x . .. ../.. ../../.. ../../../.. ../../../../.. ../../../../../.. ../../../../../../..

and hope that's enough :)


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/_8jpEFytyesJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment