Skip to content
Tools.Town
290+ free online tools
Developer Tools

Chmod 755 vs 644: Which Permissions and When

755 for directories and executables, 644 for regular files — why those defaults exist, what each digit means, when 700/600 is safer, and why 777 is almost always wrong.

16 August 2026 4 min read By Tools.Town Team Fact Checked

Key Takeaways

  • Why do directories need execute permission: On Unix, execute on a directory means permission to traverse into it
  • When is 777 acceptable: Rarely — perhaps a throwaway local experiment
  • What about 600 and 700: Use 600 for secrets (private keys, .env files, wp-config.php on hardened hosts) and 700 for private scripts or directories only your user should touch

Every hosting-panel warning and deploy script eventually arrives at the same two numbers: 755 for directories, 644 for files. Here is what they actually mean and when to deviate.

Reading a mode digit by digit

A 3-digit octal mode assigns permissions to owner / group / other, in that order. Each digit is a sum: read = 4, write = 2, execute = 1.

ModeOwnerGroupOtherMeaning
755rwxr-xr-xOwner full; everyone else read + traverse/execute
644rw-r—r—Owner read/write; everyone else read-only
700rwx------Private directory or script
600rw-------Private file (keys, secrets)
777rwxrwxrwxAnyone on the machine can modify — avoid

Build any of these interactively with the Chmod Calculator — toggle the checkboxes or decode an octal string back into flags.

Why 755 for directories

On Unix, execute on a directory means traverse — permission to enter it and reach the files inside. A web server running as a different user needs r-x on your directories to serve files from them. Take away the x and every request under that path 403s.

Why 644 for files

Regular files (HTML, PHP, images, CSS) never need execute — the web server reads them; the interpreter is invoked by the server, not the file. 644 lets the server read while only your account can edit. Scripts you run directly from a shell (./deploy.sh) are the exception — those need the owner execute bit: 744 or 755.

When to go tighter

  • wp-config.php, .env, private keys → 600
  • Backup folders, personal scripts → 700
  • Password-protected areas: permissions control the filesystem, not HTTP — pair with an .htpasswd file for web-level auth.

The 777 trap

777 “fixes” permission errors by giving every account on the host write access to your files — on shared hosting, that includes other customers’ compromised sites. The error 777 papers over is almost always an ownership mismatch (files owned by root or the wrong user after a migration). Fix with chown, not chmod 777. Step-by-step recovery: Fix WordPress File Permissions.

Advertisement

Try Chmod Calculator — Free

Apply what you just learned with our free tool. No sign-up required.

Try Chmod Calculator

Frequently Asked Questions

Why do directories need execute permission?
On Unix, execute on a directory means permission to traverse into it. Without x, users cannot cd into the directory or access files inside it even if they can list the names. That is why directories get 755 while files get 644.
When is 777 acceptable?
Rarely — perhaps a throwaway local experiment. On any shared or production host, 777 lets every account on the machine modify your files. If an app demands 777 to work, the real problem is file ownership; fix the owner instead.
What about 600 and 700?
Use 600 for secrets (private keys, .env files, wp-config.php on hardened hosts) and 700 for private scripts or directories only your user should touch.

Was this guide helpful?

Your feedback helps us improve our content.

Get the best Developer Tools tips & guides in your inbox

Join 25,000+ users who get our weekly developer tools insights.