Skip to content

Instantly share code, notes, and snippets.

@yusufhm
Created January 15, 2015 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusufhm/e80acc266ae1e33a05c2 to your computer and use it in GitHub Desktop.
Save yusufhm/e80acc266ae1e33a05c2 to your computer and use it in GitHub Desktop.
Fix Drupal files permissions (credits to James Wilmot)
#!/bin/bash
#
# A script to fix file permissions in the given
# files directory for drupal
#
# Usage:
# - set files directory variable to point at the files
# drupal installation files directory
# - run script
files_dir="sites/default/files"
sudo chown -R :www-data $files_dir
chmod g+ws $files_dir
find $files_dir -type d -exec chmod g+ws {} \;
find $files_dir -type f -exec chmod 664 {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment