Skip to content

Instantly share code, notes, and snippets.

View willfull's full-sized avatar

Will Fuller willfull

View GitHub Profile
@willfull
willfull / wpfix.sh
Created January 19, 2017 16:23
Script to automate ownership and permissions reset for WordPress sites.
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Original author: Michael Conigliaro (https://gist.github.com/macbleser/9136424)
# Modified by willfull on 17 January 2017 (https://gist.github.com/willfull/3fe400a3ec0abc8e6ea3fba56a1bfd59)
#
WP_ROOT=${1:-.} # <-- wordpress root directory, current directory by default
[ -e "$WP_ROOT/wp-config.php" ] || { echo "Usage: $0 /path/to/wordpress"; exit; } # <-- detect that the directory is a wordpress root