I have written this small bash script to rebuild D6.22 file permissions:
#!/bin/bash
cd /path/to/drupal
chown -R bob:www-data .
find . -type d -exec chmod u=rwx,g=rx,o= {} \;
find . -type f -exec chmod u=rw,g=r,o= {} \;
cd /path/to/drupal/sites
find . -type d -name files -exec chmod ug=rwx,o= '{}' \;
find . -name files -type d -exec find '{}' -type f \; | while read FILE; do chm$
find . -name files -type d -exec find '{}' -type d \; | while read DIR; do chmo$
chmod -R 777 /path/to/drupal/sites/default/files #bad idea??
chmod -R 755 /path/to/drupal/tmp
echo "Permissioin rebuild is done!"
Of course prior to executing the script 'bob' should have been added to www-data group using
usermod -G www-data bob
I know that a security-aware admininstrator should avoid giving 777 permission to web server, however when I assign 755 to files, users can not upload image/avatars and I get a warning that says sites/default/files/pictures/picture is not writable.
So what alternative permission do you use for 'files' (and works)?
Thanks