Chmod 644 – Linux Permission Guide
What It Means, Explanation, How to Use, When to Use & More
chmod 644
The Standard for Publicly-Readable Files
chmod 644 [filename]
Copy
find . -type f -exec chmod 644 {} \;
Copy
find . -type d -exec chmod 755 {} \;
Copy
ls -l [filename]
Copy
chmod -R 644 on a website directory
Running chmod -R 644 . will strip the execute bit from every directory and take your site offline. Use the two find commands above instead. Full explanation below.
What Does chmod 644 Mean?
In Linux, 644 is an octal representation of file system permissions. It's the default permission for most regular files on Linux and the recommended setting for web server content like HTML, CSS, images, and PHP files. The owner can read and write; everyone else can only read.
User (6)
Read + Write
The owner can view and edit the file, but can't execute it as a program.
Group (4)
Read Only
Users in the file's group can view the contents but cannot modify them.
Others (4)
Read Only
Everyone else on the system — including your web server — can read the file.
A web server like Apache or nginx only needs to read your HTML, CSS, and image files to serve them to visitors. It doesn't need to write to them or execute them. 644 gives the server exactly what it needs and nothing more — the principle of least privilege applied to a public website.
Why "644"? How the Numbers Work
Every digit in a chmod code is the sum of three values. Once you know the math, you can decode any permission at a glance.
Add them together to build any permission digit:
So 644 reads as: 6 for owner (read + write), 4 for group (read only), 4 for others (read only).
Permission Matrix (rw-r--r--)
| Level | Read (r) | Write (w) | Execute (x) |
|---|---|---|---|
| Owner | ✔ | ✔ | ✘ |
| Group | ✔ | ✘ | ✘ |
| Others | ✔ | ✘ | ✘ |
Numeric vs Symbolic Notation
chmod accepts two equivalent styles. All three commands below produce identical results:
Letters used in symbolic mode: u = user (owner), g = group, o = others, a = all. Operators: + adds a permission, - removes it, = sets it exactly.
How to Verify It Worked
After running chmod, use ls -l to check the result:
If you prefer a numeric check, stat -c "%a %n" filename prints the permission as an octal number — you should see 644 confirmed.
The 644 + 755 Pairing (Essential for Websites)
You almost never apply 644 in isolation. On a real website, 644 comes paired with 755 for directories. This pair is the universal baseline for every shared host, VPS, and CMS on the internet.
HTML, CSS, JS, images, PHP scripts, config files. Owner edits, everyone reads.
Folders need the execute bit to be traversable. Without it, the web server can't enter the folder to reach the files inside.
Why directories need 755, not 644: On a directory, the "execute" permission doesn't mean "run it" — it means "enter it." Set a directory to 644 and you can see its name but not access the contents. Your web server will throw a 403 error trying to reach files inside.
The correct one-two punch for an entire website tree is:
When to Use chmod 644 (Real Examples)
WordPress file permissions Most common
WordPress officially recommends 644 for all files and 755 for all directories. This is the #1 reason people search for chmod 644. Run these from your WordPress root:
Your wp-config.php file contains your database password in plain text. On shared hosting, 644 means every other customer on the server can read it. Set it to 600 (owner-only) or 440 as soon as you finish installing WordPress.
Static HTML, CSS, and image files
Any file served by Apache or nginx that the web server only needs to read. This includes your theme's CSS, uploaded images, JavaScript bundles, and HTML pages.
Config files in your home directory
Files like .bashrc, .gitconfig, and .htaccess that should be readable by the system but only editable by you.
Exception: files containing secrets (.env, .npmrc with auth tokens, SSH authorized_keys) should usually be 600 instead — no one but you should even read them.
The -R 644 Trap (Read This Before You Break Your Site)
This is the single most common way people accidentally take their own website offline: running chmod -R 644 on a whole directory. It seems logical — "I want all my files to be 644, so I'll apply 644 recursively." But it also applies 644 to every directory, which strips the execute bit and makes the folders impossible to enter.
chmod -R 644 on a website
Apache/nginx tries to enter wp-content/ to serve an image. Permission denied. Every page returns 403 Forbidden or a blank white screen. WordPress admin won't load. File uploads fail. Your site is down until you reverse it.
The fix is to set files and directories separately using find:
If you already did it: run the two correct find commands above to fix it. Your files will be back to 644 and directories back to 755, and your site will come back online.
Why Are My Files Already 644? (The umask Answer)
A lot of people land on chmod 644 guides not because they're setting 644 but because they noticed their files already are 644 and want to know why. The answer is umask.
Every user on a Linux system has a umask — a "permission mask" that subtracts bits from the default creation mode. Most distributions ship with umask 022, which means:
That's why you see 644 files and 755 directories appearing everywhere automatically — it's the default environment, not something someone set manually. Check yours with the umask command. Add umask 022 or umask 027 to ~/.bashrc to lock it in.
Changing Permissions Without a Terminal
If you're on shared hosting, you may not have SSH access — but you can still set 644 through your hosting control panel or FTP client.
cPanel File Manager
- Log in to cPanel and open File Manager
- Navigate to the file (usually inside
public_html/) - Right-click the file and choose Change Permissions (or highlight and click the Permissions icon)
- Enter
644in the numeric field, or check: Owner Read/Write, Group Read, Public Read - Click Change Permissions
FileZilla (FTP)
- Connect to your server via FileZilla
- Right-click the file in the remote pane
- Choose File permissions…
- Enter
644in the "Numeric value" field - Click OK
WordPress (whole-site fix)
If you don't have command-line access but need to bulk-fix WordPress permissions, a plugin like All In One WP Security has a "File System Security" tool that will flag and offer to fix any file not set to 644 (and directories not set to 755).
Plesk
- Open Files in your Plesk dashboard
- Click the checkbox next to the file
- Click Change Permissions in the toolbar
- Set Owner to Read+Write, Group and Others to Read only
chmod 644 vs Other Common Permissions
Before committing to 644, check whether a neighbor might fit better:
| Code | Symbolic | Typical Use |
|---|---|---|
600 |
-rw------- |
Private files only you should read — wp-config.php, .env, SSH private keys, tokens |
640 |
-rw-r----- |
Owner edits, group reads, nothing for everyone else. Stricter alternative to 644 on VPS / multi-tenant hosts |
644 |
-rw-r--r-- |
The web's default. HTML, CSS, JS, images, PHP scripts — anything the web server needs to read but not modify |
664 |
-rw-rw-r-- |
Owner and group can both write. Used on some shared hosts where WordPress runs as a different user than you FTP in as |
755 |
drwxr-xr-x |
Default for directories. Owner has full access; everyone else can enter and read, but not modify |
777 |
-rwxrwxrwx |
Avoid. Everyone can read, write, and execute. The "nuclear option" people reach for to fix upload errors — and a common cause of hacked sites |
Ownership Matters As Much As Permissions
644 is only half the story. Even with perfect permissions, the wrong owner can leave your web server locked out or give write access to the wrong user.
The usual ownership pattern for a WordPress or PHP website on a VPS:
The web server user is typically www-data on Debian/Ubuntu, apache on RHEL/CentOS/Rocky, or nginx on some nginx-only setups. Check with ps aux | grep -E 'apache|nginx|php-fpm'.
Troubleshooting
Directories need the execute bit to be entered. Run chmod 755 foldername, or fix an entire tree with find /path -type d -exec chmod 755 {} \;
Apache rejects PHP or CGI scripts that are group- or world-writable. Make sure scripts are 644 (or 755 for CGI), and .htaccess is 644. A quick fix: chmod 644 .htaccess.
wp-content/, or the directory isn't writable by that user.
This isn't a 644 problem — WordPress needs to write to wp-content/uploads, wp-content/plugins, and wp-content/themes. Check ownership with ls -l wp-content/ and fix with sudo chown -R www-data:www-data wp-content/ (or your deploy user, depending on your setup).
Fix with the two-command find recipe: find /path -type d -exec chmod 755 {} \; restores directory traversability, then find /path -type f -exec chmod 644 {} \; keeps files at 644.
uploads directory isn't writable by the user PHP runs as.
Don't "fix" this with chmod 777. Instead, identify your PHP user (usually www-data, apache, or nginx) and make that user the owner or group-owner of wp-content/uploads. Then 755 on the directory is enough.
Only the file's owner (or root) can change permissions. Use sudo chmod 644 filename if you have sudo, or ask your hosting provider to fix ownership if you're on shared hosting.
In FileZilla: Edit → Settings → Transfers → FTP: File Types → Default transfer type, and check the "Preserve timestamps / permissions" options. On the server side, the FTP/SFTP daemon may have a umask setting in its config. Some shared hosts set files to 664 by design — that's usually fine.
The Universal Website Permissions Reset
If you've been poking at permissions and everything's a mess, this is the recipe to bring things back to a known-good state for almost any PHP/static website:
After running this, verify with ls -la and try loading the site in a browser. 9 times out of 10 this fixes whatever was broken.
Frequently Asked Questions
Almost never. Directories need the execute bit (1) to be entered — without it, nothing inside the folder is reachable. Use 755 for directories and 644 for the files inside them.
The middle digit. 644 gives the group read-only access; 664 gives the group read + write. Use 664 when multiple users in the same group (e.g., you and WordPress's PHP process) both need to edit the same files. On many shared hosts this is actually required for plugin installs and auto-updates to work.
Not ideal. wp-config.php holds your database credentials in plain text. 644 means any other user on the server (other customers on shared hosting, for example) can read it. Set it to 600 or 440 after WordPress finishes installing.
That's your umask. Most Linux systems default to umask 022, which creates new files as 644 and new directories as 755. You didn't set it — the system did. Run umask to see your current value.
-rw-r--r-- when viewed with ls -l. To set it symbolically: chmod u=rw,go=r filename.
Yes — for files you own. Only the file's owner or root can change permissions. Files owned by root, www-data, or another user require sudo chmod 644 filename.
On a single-user VPS or shared hosting where you control everything: 644 is simpler and works everywhere. On a multi-tenant VPS where other customers share the box: 640 is stricter, giving the web server group read access while locking out everyone else entirely. 644 is the common baseline; 640 is the hardened version.
Either ownership is wrong (check with ls -l — is the group something the web server can access?), or a parent directory is missing its execute bit, blocking traversal. Walk up the directory tree and make sure every folder from root down to your file is at least 755 (or has the web server's group in the group slot with read+execute).
–