File Permissions — Why 755 and 644 Appear Everywhere

Linux file permissions explained without the math. What rwx means, why 755 and 644 are the WordPress standard, and how to fix the four most common permission errors without reaching for chmod 777.

Terminal showing ls -la output with permission strings highlighted — rwxr-xr-x and rw-r--r-- explained

Every file on a Linux server has a permission attached to it. That permission controls who can read it, write to it, or execute it — and which users fall into which category.

When this is set up correctly, you never think about it. When it’s wrong, you get a wall of permission errors and a WordPress site that can’t do basic things.

This article explains the system once, clearly, so you can fix any permission error you encounter without reaching for chmod 777.


How Permissions Work

Run ls -la in any directory and you’ll see something like this:

-rw-r--r--  1 nginx nginx  4521 Jun 1 10:00 wp-config.php
drwxr-xr-x  5 nginx nginx  4096 Jun 1 10:00 wp-content

The first column — -rw-r--r-- or drwxr-xr-x — is the permission string. It has 10 characters.

Character 1 — file type:

  • - = regular file
  • d = directory

Characters 2–4 — owner permissions (what the file’s owner can do)

Characters 5–7 — group permissions (what members of the file’s group can do)

Characters 8–10 — everyone else (any other user on the system)

Each group of three uses the same letters:

  • r = read (view file contents or list directory)
  • w = write (modify file or create files in directory)
  • x = execute (run file as a program, or enter directory)
  • - = permission not granted
Permission string rwxr-xr-x broken into four sections: file type, owner permissions, group permissions, others permissions — each letter labeled
Ten characters that tell you everything about who can do what with a file.

Reading a Real Example

-rw-r--r--  nginx  nginx  wp-config.php

Breaking this down:

  • - — regular file (not a directory)
  • rw- — owner (nginx) can read and write. Cannot execute
  • r-- — group (nginx) can read only
  • r-- — everyone else can read only

This is 644 in numeric notation — the standard for WordPress files.

drwxr-xr-x  nginx  nginx  wp-content
  • d — directory
  • rwx — owner (nginx) can read, write, and enter
  • r-x — group can read and enter, but not create files inside
  • r-x — everyone else can read and enter

This is 755 — the standard for WordPress directories.


The Numbers — How 644 and 755 Work

Each permission (r, w, x) has a numeric value:

  • r = 4
  • w = 2
  • x = 1

Add them for each group:

  • rwx = 4+2+1 = 7
  • r-x = 4+0+1 = 5
  • rw- = 4+2+0 = 6
  • r-- = 4+0+0 = 4

So:

  • 755 = owner rwx (7), group r-x (5), others r-x (5)
  • 644 = owner rw- (6), group r— (4), others r— (4)

You don’t need to calculate this from scratch every time. Just remember the two numbers that matter for WordPress: 644 for files, 755 for directories.

Two-column reference card: 644 for files showing rw-r--r-- breakdown, 755 for directories showing rwxr-xr-x breakdown
644 and 755 — the two numbers you'll use for WordPress. Bookmark this.

Why Ownership Matters as Much as Permissions

Permissions tell you what’s allowed. Ownership tells you who the rules apply to.

On Rocky Linux, Nginx runs as the nginx user. When Nginx serves a WordPress page, it’s doing so as nginx. If your WordPress files are owned by a different user — say, your SSH login user — Nginx hits the “everyone else” permission tier, not the “owner” tier.

This means even files with 644 permissions can fail if ownership is wrong. The owner gets rw-. Everyone else gets r--. Nginx is everyone else.

Fix: make nginx the owner.

sudo chown -R nginx:nginx /var/www/yoursite/

-R applies the change recursively to everything inside the directory.


The Four WordPress Permission Errors and How to Fix Them

1. WordPress can’t upload images

Symptom: Media uploader fails. Error: “Unable to create directory wp-content/uploads.”

Cause: The wp-content/uploads directory isn’t owned by nginx, or doesn’t have write permissions.

Fix:

sudo chown -R nginx:nginx /var/www/yoursite/wp-content/uploads
sudo chmod -R 755 /var/www/yoursite/wp-content/uploads

2. Nginx returns 403 Forbidden

Symptom: Browser shows a 403 error. Nginx error log shows: open() "/var/www/yoursite/index.php" failed (13: Permission denied)

Cause: Nginx can’t read the files — wrong ownership or overly restrictive permissions.

Fix:

sudo chown -R nginx:nginx /var/www/yoursite/
sudo find /var/www/yoursite/ -type f -exec chmod 644 {} \;
sudo find /var/www/yoursite/ -type d -exec chmod 755 {} \;
Terminal showing chown command followed by find+chmod commands, then ls -la output showing corrected ownership and permissions
The standard fix sequence: chown sets ownership, find+chmod sets permissions on files and directories separately.

3. WordPress can’t install or update plugins

Symptom: Plugin installation fails with “Could not create directory.”

Cause: The wp-content/plugins directory isn’t writable by Nginx.

Fix:

sudo chown -R nginx:nginx /var/www/yoursite/wp-content/
sudo chmod -R 755 /var/www/yoursite/wp-content/

4. SSH won’t connect — “bad permissions” on key file

Symptom: SSH refuses to use your key file. Error: WARNING: UNPROTECTED PRIVATE KEY FILE! Permissions 0644 for '/home/user/.ssh/id_rsa' are too open.

Cause: SSH requires private key files to be readable only by the owner. Group or world-readable keys are rejected as a security measure.

Fix:

chmod 600 ~/.ssh/id_rsa
chmod 700 ~/.ssh/

600 means owner read/write only — no group, no others.


Why chmod 777 Is Always the Wrong Answer

777 gives read, write, and execute to everyone — owner, group, and any other process or user on the system.

When you’re frustrated by a permission error, chmod 777 fixes it immediately. That’s why people use it. The problem: it stays that way.

On a web server, 777 means any PHP script executed by your site — including code inside an insecure plugin — can write to that file. It’s not a theoretical risk. Compromised WordPress plugins that write malicious files to the server are real and common.

The correct fix takes two commands instead of one. That’s the full cost of doing it right.


The Quick Reference

# Set standard WordPress permissions
sudo chown -R nginx:nginx /var/www/yoursite/
sudo find /var/www/yoursite/ -type f -exec chmod 644 {} \;
sudo find /var/www/yoursite/ -type d -exec chmod 755 {} \;

# Fix uploads directory specifically
sudo chown -R nginx:nginx /var/www/yoursite/wp-content/uploads
sudo chmod -R 755 /var/www/yoursite/wp-content/uploads

# Fix SSH key permissions
chmod 600 ~/.ssh/id_rsa
chmod 700 ~/.ssh/

# Check current permissions
ls -la /var/www/yoursite/

Save these. You’ll come back to them.

Frequently Asked Questions

Why shouldn't I use chmod 777?
777 gives read, write, and execute permission to everyone — including any other process or user on the server. For a web-facing file, this means a compromised script or plugin could overwrite your files. It's a security risk that's easy to avoid with correct ownership.
WordPress can't upload images — how do I fix it?
The wp-content/uploads directory needs to be owned by the web server user (nginx on Rocky Linux) and have 755 permissions. Run: sudo chown -R nginx:nginx /var/www/yoursite/wp-content/uploads && sudo chmod -R 755 /var/www/yoursite/wp-content/uploads
What's the difference between chmod and chown?
chmod changes what actions are allowed on a file (read, write, execute). chown changes who owns the file. Both are needed — correct permissions with wrong ownership still causes access errors.
How do I check what permissions a file has?
Run ls -la in the directory containing the file. The first column shows the permission string (e.g. -rw-r--r--) and the third and fourth columns show the owner and group.