WebFaction
Community site: login faq

I am developing a Django application that includes the ability for users to upload a picture that is displayed on certain pages. However, I am encountering an error that is related to the file permissions given to the image files upon upload. Some (but not all) pictures do not show up on the pages. When I try to access them directly (with the image URL) I get a 403 error.

I checked on the server via SSH, and found that some pictures were getting different file permissions than the others. The pictures that did show up had permission of 644 (so they are readable by everyone), while the ones that didn't show had permissions of 600 (not readable by anyone other than owner). I am bewildered as to why some uploads would receive different permissions than others.

The pictures are being stored in a folder in my static application. I changed all the picture files to have correct permissions, but some subsequent uploads are still having the permissions problem. Is there something I need to do to force all uploaded files to to have read permissions for everyone?

asked 08 Apr, 18:24

pda6ne
112
accept rate: 0%


Run the following commands within the media directory via SSH,

find . -type d -print0 | xargs -0 chmod 0775 # For directories
find . -type f -print0 | xargs -0 chmod 0664 # For files

This should reset the permissions to a safe default and fix upload issues.

permanent link

answered 08 Apr, 22:11

johns ♦♦
5.2k211
accept rate: 22%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×900
×62
×28
×12

question asked: 08 Apr, 18:24

question was seen: 451 times

last updated: 08 Apr, 22:11

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2016 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM