Blueprints · WordPress
Beginner
10 min · Linux
WordPress file permissions check
Prints permissions and refuses to chmod the tree. World-writable PHP is the thing to fix by hand.
Live config
Baked-in protections
- The check does not chmod
- wp-config.php should be 640 or 600
- Directories should not be 777
Step 1 · bash
Read-only check
/root/portgate-blueprints/wp-perms-check.sh
Lists world-writable files. It does not change them.
#!/bin/sh
set -eu
if [ -d "/var/www/html" ]; then
find "/var/www/html" -perm -0002 -type f | head
if [ -f "/var/www/html/wp-config.php" ]; then
stat -c '%a %n' "/var/www/html/wp-config.php"
fi
else
echo "WordPress root is missing."
fi
Step 2 · text
Permission note
/root/portgate-blueprints/wp-perms.txt
Apply these yourself after a backup. The bundle does not chmod.
Directories 755. Files 644. wp-config.php 640. Owner is the deploy user. The PHP pool user can read, not write, except wp-content/uploads.