Python under uWSGI creates files and dirs with wrong permissions Python under uWSGI creates files and dirs with wrong permissions nginx nginx

Python under uWSGI creates files and dirs with wrong permissions


This is caused by uWSGI's default umask of 000 which leaves all bits in place - which means a default of 666 for files or 777 for directories.

You can chance this by setting the umask option on your uWSGI config file to the bits that should be removed. For example, to get 644/755, you'd use an umask of 022 which cleary the write flag for group/other (777-022 = 755, 666-022 = 644)