PortGate

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

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.