Today I noticed that whenever I upload a file through my Django site the file is uploaded with the file permissions 0600 meaning whenever a non root user wants to view the file (nginx) a 403 is shown.
This only started happening today from what I can tell. I have checked both the file_upload_permissions and file_upload_directory_permissions in the Django settings file and they are both set to 0644.
I haven't done any Linux/Django updates recently so that shouldn't be the cause, any help would be greatly appreciated.
Thanks,
Sam
If you have recently switched to Python 3, please take a look at here for a reference to octal literals in Python 3. Changing your settings as follows should fix it:
FILE_UPLOAD_PERMISSIONS = 0o644
This is also helpful in writing Python 2-3 compatible code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With