I am running a Django application using Apache webserver.
The media directory is located in /var/www/app/media/. Owner of that directory is www-data:www-data, so that Apache can read / write to it.
The problem now is that when I run ./manage.py migrate and a new sub-folder in the media directory is created when I add a new FileField to a model, the owner of that directory is the user running that migrate command and I have to fix the owner of that new folder, otherwise Apache can't write to it and I am getting a Permission denied error.
How can I set permissions to the folder /var/www/media/that user www-data can write to any new subfolder, even when that subfolder is created by another user ?
you can do sudo chmod -R 775 /var/www/media/