Proper folder permissions: Drupal & Ubuntu

For some reason, I can't find D.O documentation on the proper folder permissions for Drupal on Linux. So for those of you a-searchin', here's my setup:

Edit: the handbook page is http://drupal.org/node/244924 (from comment), so go there to see alternatives and discussion.

cd /var/www

# u=rwx,g=rx for security
sudo chown -R {username}:www-data .
sudo chmod -R 750 .

# Let apache write to sites/{sitename}/files directories
find . -type d -wholename "*/sites/*/files" -exec sudo chmod -R 770 {} \;

# Make sure newly-created files retain the www-data group (useful for Drush)
# You don't want to apply this to files, only directories.  Hence the round-about method
sudo chmod g+s .
find . -type d -exec sudo chmod g+s {} \;

2 Comments

There's a handbook page

There's a handbook page (Securing file permissions and ownership) about file and directory permissions, including the steps to set permissions on a Linux server.

So it does exist! I'll hit

So it does exist! I'll hit it up soon & leave a comment, thanks!