403 Forbidden from File Permissions: How to Fix 644 and 755

403 Forbidden from File Permissions: How to Fix 644 and 755

Written by

in

Lab-tested: Staged chmod on file and folder (Python 3.13.5) · 2 Dec 2026 · Reproduced and fixed in our lab

Fix Box — Try this first (10 seconds)

Check the error log first. A line that says “Permission denied” means file permissions, not a rule. Set files to 644 and folders to 755, recursively.

Then reload the page. If the log says “access forbidden by rule” instead, read our .htaccess guide.

What a permission 403 looks like

The page exists, but the server cannot read it. The browser shows a plain “403 Forbidden” page. Nothing about the page content is broken.

This cause is common after migrations and restores. Files arrive with the permissions of the old system. The new server then refuses to serve them.

How 644 and 755 actually work

Each number is a sum: read is 4, write is 2, execute is 1. The three digits cover the owner, the group, and everyone else.

So 644 means the owner can read and write, and everyone else can only read.

Folders need execute permission, not just read. Execute on a folder means “search inside it”.

A folder set to 644 looks readable, but the server cannot open files inside it.

Our lab test: staged chmod on a file and a folder

We ran a staged permission matrix on a local lab server on 2 Dec 2026. The baseline file at 644 returned 200.

Then we changed one permission at a time and requested the file again.

Three file modes returned 403: 000, 200, and 040. Each one lacks read permission for the owner. The log recorded the same reason every time:

2026/12/02 02:00:08 [error] open() "/tmp/lab403broot/index.html" failed (13: Permission denied), client: 127.0.0.1, request: "GET /index.html HTTP/1.1"

Modes 400, 600, and 644 returned 200. So did 666 and 777, which work but are risky.

Our lab server ran as the file owner, so owner-read was enough.

The folder test surprised us. A folder at 644 returned 403 for the file inside it.

The file itself was still 644, but the folder had no execute bit.

Folder modes 755 and 700 returned 200. Folder 000 returned 403. Restoring 755 brought the file back at once.

Step-by-step fix

First, read the error log and confirm the words “Permission denied”. That line separates this cause from deny rules. Our 403 Checker walks through the same check.

Second, set files to 644 and folders to 755. Use your host file manager, or run these commands over SSH:

find /path/to/site -type f -exec chmod 644 {} +
find /path/to/site -type d -exec chmod 755 {} +

Third, reload the page. If it still returns 403, the block is another layer. Compare with the Decision Tree and the pillar guide.

One honest caveat from our lab: our server ran as the file owner. Many shared hosts run the server as a different user.

On those hosts, 600 can still 403, because the server falls into “everyone else”. That is exactly why 644 is the safe standard.

What Did Not Work

Setting the folder to 644 did not fix anything. It made things worse: the file inside became unreachable. Folders need 755, because they need the execute bit.

Setting everything to 777 did “work” in the lab. Every request returned 200.

But 777 lets anyone write to your files, so we count it as a failed fix, not a solution.

Prevention

After any migration or restore, run the two find commands before testing pages. Check permissions again after bulk uploads.

Our Permission Checker gives a verdict for any mode before you apply it.

FAQ

Frequently Asked Questions

Is 777 ever the right fix?

No. It hides the real problem and opens write access to everyone. In our lab it returned 200, but so did the safe 644 and 755.

Why does one folder 403 while the rest of the site works?

Permissions apply per file and per folder. One folder without execute permission blocks only its own contents. Fix that folder to 755.

What about file ownership?

Wrong ownership can look identical to wrong permissions. If 644 and 755 do not help, ask your host to check ownership. The log line stays “Permission denied” either way.

Sources and date

Lab test: 2 Dec 2026, local lab server on our SI machine (Python 3.13.5, staged chmod matrix on one file and one folder, log lines above verbatim, client IP is localhost).

This page follows the 403.my.id LAB standard: reproduction, before-and-after logs, tested config, and one diagnostic aid (the Permission Checker).

References

  • RFC 9110 §15.5.3 — 403 Forbidden: https://www.rfc-editor.org/rfc/rfc9110.html
  • MDN Web Docs — 403 Forbidden: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/403
  • chmod(1) — Linux manual page: https://www.man7.org/linux/man-pages/man1/chmod.1.html
  • Nginx — ngx_http_access_module: https://nginx.org/en/docs/http/ngx_http_access_module.html

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *


More posts