Table of contents11
I learned about file permissions the way most of us learn things we ignore for too long: something broke, and the fix took far longer than the problem deserved. A client called me on a Sunday afternoon. Someone had uploaded a malicious file into his site’s uploads folder, and his hosting company suspended the whole account until it was cleaned. When I asked support how it got in, the answer was one word I did not understand back then: permissions.
I am Daniel Okafor. I harden WordPress sites for a living, and I have run permission audits on more than a hundred of them. Almost every site I touch has at least one folder or file with permissions that are too loose, and the owner has no idea.
If you have never thought about which files on your server can be read, changed, or run, you are in the right place. In this guide I will show you the exact process I use on every site: a ten-minute audit, the table of what every path should be, the copy-paste commands to fix them over SSH, the no-terminal way in cPanel, and a five-minute monthly routine that keeps them tight. Let us get to work.

One quick trust note before we start: I will not tell you to buy any security plugin in this guide. You do not need one for this job. Everything here uses tools your hosting already gives you — a terminal, or the File Manager in your hosting panel.
Here is what this guide covers:
- Understand What File Permissions Mean in Plain Words
- Step 1: Audit Your Site Before You Change Anything
- Step 2: Apply the Permission Table (What Every Path Should Be)
- Step 3: Fix Permissions With SSH Commands
- Step 4: Fix Permissions in cPanel File Manager (No Terminal)
- Fix Ownership: The Part Everyone Forgets
- Handle the Uploads Directory Exception
- Confirm Updates and Backups Still Work After Tightening
- Set Up Your Monthly Permission Check Routine
- Frequently Asked Questions
- Final Thoughts
Ready? Let’s get started.
What File Permissions Mean in Plain Words
The first time I saw `644` and `755` I thought they were error codes. They are not. They are just a short way of answering three questions about every file on your server: who can read it, who can change it, and who can run it.
Here is the deal: every file and folder has three groups of people attached to it. The owner (your hosting account), the group (a small circle of server users), and everyone else (other accounts on a shared server, and WordPress itself). For each group, the server stores three switches: read (4), write (2), and execute (1). The number you see, like 644, is the sum of those switches for owner, group, and others, read left to right.
So 644 means: the owner can read (4) and write (2) — that is 6. The group can only read — 4. Everyone else can only read — 4. On folders, “execute” means “can enter the folder,” which is why folders get 755 and files get 644: folders need the enter switch, files need nothing more than read for the outside world.
Once you can read those three digits, the whole guide becomes simple: 777 means everyone can do everything to a file. That is the number that keeps me up at night.
Step 1: Audit Your Site Before You Change Anything
Here is a mistake I made for years: I used to fix permissions before measuring them. Then a “fix” broke an image upload page on a client site, and I could not tell whether I caused it or whether it was already broken. Since that day I never touch anything until I have a before picture. You will do the same.
If your hosting gives you SSH access, log in and move into your WordPress folder (usually `public_html`), then run:
“` find . -type f -perm -o=w find . -type d -perm -o+w “`
The first lists every file anyone on the server can write to — on a healthy site, close to nothing. The second lists world-writable folders, which are worse than loose files: a writable folder is a place where an attacker can drop something new. If either list scrolls for pages, you have work to do.
For a second opinion on the important files:
“` ls -l wp-config.php .htaccess index.php “`
You want to see 600 or 640 for wp-config.php, and 644 or 444 for .htaccess — if you see 666 or 777 in that output, you have found your problem areas in under a minute.
No SSH access? Do the same audit by eye in your hosting panel’s File Manager: right-click a folder or file, choose Permissions, and read the number. Start with the big three — `wp-config.php`, `wp-content`, and `uploads`.
Bonus tip: screenshot the terminal output before you change anything. That before picture is how you prove the fixes below actually worked. And while you are in audit mode, check for signs something already slipped in — my guide on [how to detect a hidden backdoor on your WordPress site](https://hyperdaf.com/how-to-detect-a-hidden-backdoor-on-your-wordpress-site/) walks through that check.
Step 2: Apply the Permission Table
Every good permission guide boils down to one table, and this is mine — applied to more than a hundred sites without breaking one. Every row shows the path, the number, and how to verify it.
| Path | Correct permission | What it means | Verify with | |—|—|—|—| | All directories | 755 | Owner can do everything; everyone else can read and enter | `find . -type d -not -perm 755` returns nothing | | All files | 644 | Owner can read and write; everyone else can read only | `find . -type f -not -perm 644` returns nothing | | wp-config.php | 600 | Only the owner can read and write — nobody else | `ls -l wp-config.php` shows `-rw——-` | | .htaccess | 444 (or 644) | Read-only; WordPress still reads it fine | `ls -l .htaccess` shows `-r–r–r–` | | wp-content/uploads | 755 (see the exception section) | Writable by the site process, not the world | `find wp-content/uploads -perm -o=w` returns nothing |
Two honest notes. On some shared hosts, wp-config.php at 600 can cause a blank white screen if the server reads files as a different user than your account — if that happens, step up to 640. And .htaccess at 444 is my preference because WordPress does not need to write to it after permalinks are saved; use 644 if you change permalinks often.
Why 600 for wp-config.php specifically? Because that file holds your database password and your secret keys — the single most valuable file on your server. At 644, any other user on a shared server can read it. Tightening it to 600 is the cheapest security win on this list, and it takes ten seconds.
Step 3: Fix Permissions With SSH Commands
This is the part where people expect something scary. It is not. Three copy-paste commands fix an entire WordPress site, and I have run them so many times I could type them in my sleep.
Run these from your WordPress root folder (usually `public_html`):
“` find . -type d -exec chmod 755 {} \; find . -type f -exec chmod 644 {} \; chmod 600 wp-config.php “`
The first sets every folder to 755. The second sets every file to 644. The third locks down wp-config.php to 600.
Now the verification triple — because a fix you do not verify is just a guess:
“` find . -type f -perm -o=w find . -type d -perm -o+w ls -l wp-config.php .htaccess “`
The first two should return nothing. The last should show `-rw——-` for wp-config.php and `-r–r–r–` (or `-rw-r–r–`) for .htaccess. When your audit from Step 1 and this verification tell the same story, the job is done.
One warning from a real mistake I witnessed: never run `chmod -R 777` on anything as a “quick fix” for an upload error — I watched a developer do this on a live shop, and the host flagged the account within the hour. If uploads break after tightening, the answer is the uploads exception below.
Step 4: Fix Permissions in cPanel File Manager (No Terminal)
No SSH access? No problem. I hardened my first dozen sites entirely through cPanel, and the result was identical. The path is just clickier.
Open File Manager and go into your WordPress folder. Select all the folders (not files), right-click, and choose Change Permissions. Uncheck everything for Group and World except Read and Execute — the Owner column stays fully checked. That gives you 755. Then select all the files, right-click Change Permissions, and set Owner to Read plus Write, Group and World to Read only. That is 644.
Now the two special files. Find `wp-config.php`, right-click Change Permissions, and uncheck every box except Read and Write for Owner — the number should read 600. Do the same for `.htaccess` but leave only Read checked in all three columns (444), or use 644 if you change permalinks often.
To verify, right-click the same files again and re-read the number, then load your homepage and the WordPress dashboard. If both load, your site now runs on the same permission table the SSH section uses.

Fix Ownership: The Part Everyone Forgets
Permissions are only half the story. Every file also has an owner — the user account the server considers its boss — and wrong ownership quietly undoes correct permissions.
Permissions are the lock on the door. Ownership is who holds the key. A file can have perfect 644 permissions and still be writable by the web server user (often called `www-data` or `nobody`) if that user owns it.
The rule I follow: files should be owned by your hosting account user, not by the web server user. Check the third column of `ls -l` — your own username means you are fine. Seeing `www-data` or `nobody` means asking your host’s support to fix ownership; most have a one-click tool, and on cPanel the correct owner is simply your cPanel username. Wrong ownership plus loose permissions is how defacement happens on sites whose owners swore their permissions were “fine.”
Handle the Uploads Directory Exception
Now the exception every permission guide must cover honestly, or readers will follow the table and then wonder why their media library stopped working.
WordPress needs to write into `wp-content/uploads` every time you upload an image. If the folder is locked so tightly the server process cannot write, uploads fail with a vague error and people panic.
The safe setup: the folder stays 755, and ownership does the work. Your hosting account owns the folder, and the server process writes through your group membership — how properly configured shared hosting already works. Then `find wp-content/uploads -perm -o=w` returns nothing and uploads work fine. That is the goal state.
If uploads still fail, do not loosen permissions — check two things. One: ownership, as above. Ask support whether the web server user is in your file group. Two: on Nginx, confirm your host blocks PHP execution inside the uploads folder at the server level — most good hosts do this by default, so even a smuggled-in PHP file could never run.
Confirm Updates and Backups Still Work After Tightening
This is the step that separates a finished job from a half-done one. Tighter permissions are worthless if they silently break the two things that protect you most: updates and backups.
Right after applying the table, do three checks. First, update one small plugin from the WordPress dashboard. If it updates cleanly, WordPress can still write where it needs to. If it fails with a “could not create directory” error, the problem is almost always ownership — not the 755/644 numbers — so do not loosen the numbers to make the error go away.
Second, upload an image to the media library. If it works, your uploads folder is correctly configured. Third, run your backup manually, right now — then download one copy to your own computer. A backup that lives only on the same server it protects has a single point of failure, and a backup that has been silently failing for three weeks is the cruelest discovery in this business.
I do these three checks after every permission change, no exceptions — the one time I skipped it, a client’s scheduled backups had been failing for a month, and we only found out when we needed a restore. Verify, always.

Set Up Your Monthly Permission Check Routine
Permissions drift. Plugins create new files, updates change things, developers loosen things “temporarily” and forget. I check my own sites on the first Sunday of every month — the whole routine takes under five minutes.
First, run the audit from Step 1 again — the two `find` commands for world-writable files and folders should return nothing. If something shows up, you will know which plugin or change introduced it, because you have a clean baseline from today.
Second, confirm `ls -l wp-config.php .htaccess` still shows 600 and 444. Third, list files changed in the last thirty days with `find . -type f -mtime -30` and scan for names you do not recognize. That is how I once caught a leftover installer file a migration tool had dropped with 777 permissions — it had been sitting there for weeks.
Bonus tip: pair this with your other monthly hygiene. When I do my permission check, I also glance at my [security headers](https://hyperdaf.com/wordpress-security-headers-youre-probably-missing/) and confirm my [login protections](https://hyperdaf.com/wordpress-login-security-that-goes-beyond-two-factor/) are still in place. Hardening is a habit, not a project.

Frequently Asked Questions
What happens if I set the wrong permissions — can it break my site? Yes, but it is fixable, which is why we audit first. The most common breakage is uploads or updates failing — almost always an ownership issue, not the numbers. Keep your before picture from Step 1, and restore just the affected path. Never fix a breakage with 777.
Are 644 and 755 the right numbers for every hosting type? For standard shared, VPS, and dedicated hosting on Apache or Nginx, yes — this matches the [WordPress.org hardening recommendations](https://wordpress.org/documentation/article/hardening-wordpress/). Some managed hosts use stricter setups of their own. If your host documents different numbers, follow theirs. The principle is the same: the least access that still works.
Should wp-config.php be 600 or 640? Start with 600 — only your account can read it. If your site shows a blank page after the change, your server reads files as a different user, so step up to 640. Either beats the 644 default most installers leave behind.
Do I need to redo this after every WordPress update? Not the full process. Core updates preserve existing permissions, but new files can arrive with loose defaults. That is what the monthly check is for — the `find` commands surface anything new, and fixing one file takes seconds.
Can file permissions alone stop hackers? No — and anyone who tells you otherwise is selling something. Permissions are one layer: they make it much harder to write malicious files or read your secrets. Real security is layered — tight permissions, strong logins, updates, backups. Permissions are simply the cheapest and fastest layer, which is why they come first.
Final Thoughts
That Sunday phone call about the suspended account feels like a lifetime ago, but I still think about it every time I type `chmod`. The client was not careless. His site was built with default permissions, nobody ever audited them, and a small gap sat open for months until someone walked through it. That is how most of these stories go — not a genius hacker, just an unlocked side door nobody checked.
You are past that now. You know what the numbers mean, you have an audit baseline, you have the exact table and the commands, and you have a five-minute monthly routine that keeps it all true. That puts your site ahead of most WordPress sites on the internet.
One honest line before I go: this guide protects your files, but security is never “done.” Keep updating, keep backing up, and keep checking. If this guide helped you lock down your site, or if you found a weird permission I did not mention, leave a comment — I read every one. Related reading: how to stop WordPress brute-force attacks, how to find and remove hidden WordPress malware, WordPress major versus minor updates, shared versus managed WordPress hosting, and plugin mistakes that slow WordPress.











3 comments