Skip to content

Instantly share code, notes, and snippets.

@morad7
Created January 16, 2017 16:21
Show Gist options
  • Save morad7/255aa87da5ae85e01697d84dbb4f0315 to your computer and use it in GitHub Desktop.
Save morad7/255aa87da5ae85e01697d84dbb4f0315 to your computer and use it in GitHub Desktop.
Drupal permissions
# Create a new example user.
useradd -s /bin/bash -m example;
# Now add that user to the Apache group. On Ubuntu/Debian this group is usually
# called www-data, on CentOS it's usually apache.
usermod -a -G www-data example;
# Set up a password for this user.
passwd example;
)
su - example
cd docroot
cp sites/default/default.settings.php sites/default/settings.php
# Temporarily give the web server write permissions to settings.php
chgrp www-data sites/default/settings.php
chmod g+w sites/default/settings.php
# Create the directory.
mkdir sites/default/files
# Now set the group to the Apache group. -R means recursive, and -v means
# verbose mode.
chgrp -Rv www-data sites/default/files
chmod 2775 sites/default/files
chmod g+w -R sites/default/files
chmod 444 sites/default/settings.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment