Skip to content

Instantly share code, notes, and snippets.

@tommyskott
Last active May 23, 2022 18:10
Show Gist options
  • Save tommyskott/92dda6fc39920925a92c8626ec14c497 to your computer and use it in GitHub Desktop.
Save tommyskott/92dda6fc39920925a92c8626ec14c497 to your computer and use it in GitHub Desktop.
Apache file permissions

Apache file permissions

Change owner:group recursively on everything in path

sudo chown -R www-data:www-data .

Change all the directories to 755 (drwxr-xr-x)

sudo find . -type d -exec chmod 755 {} \;

Change all the files to 644 (-rw-r--r--)

sudo find . -type f -exec chmod 644 {} \;

WordPress

wp-config.php

sudo chmod 660 wp-config.php

.htaccess

sudo chmod 644 .htaccess

SFTP and wp-cli

Add user ubuntu to group www-data

sudo usermod -aG www-data ubuntu

Add group writing ability

sudo chmod -R g+w /path/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment