chmod 777 — what rwxrwxrwx means
777
rwxrwxrwx
Everyone — owner, group, and all other users — can read, write, and execute. This is the most permissive setting possible.
⚠️ Risky permission. This grants write access beyond the owner — only use it when you truly need it, and prefer tighter, group-based permissions where you can.
Permission breakdown
When to use 777
- Almost never — and that's the honest answer. There is no normal production scenario where a file or directory genuinely needs
rwxrwxrwx. If you reached for 777, the real problem is almost always wrong ownership, not insufficient permissions. - Throwaway scratch space on a single-user machine. A temp directory on your own laptop that no other account or network user can reach is the only place 777 is harmless — and even there it buys you nothing 755 or 700 wouldn't.
- Diagnosing a permission error (temporarily). Some admins flip a path to 777 for thirty seconds to confirm a permission denial is the cause, then immediately set the correct mode and ownership. Using it as a permanent fix is where it becomes dangerous.
- World-writable shared dirs only with the sticky bit. The legitimate cousin of 777 is
1777(rwxrwxrwt) used by/tmp: everyone can write, but the sticky bit stops users from deleting each other's files. Plain 777 lacks that protection.
Common mistakes & gotchas
- 777 lets any user on the system overwrite, replace, or delete your file. On a shared host or any box with multiple accounts, that means a low-privilege user (or a compromised service) can swap your script for malware and you'll run it yourself. This is the single most abused permission in all of Unix.
- A 777 web directory is a remote-code-execution invitation. If
www-datais compromised through any uploaded file, world-writable web paths let the attacker drop and execute a shell. Scope upload dirs to the owner or web group, never to others. - “It only works at 777” means the owner is wrong. The fix is
chownto the user/group that needs access (e.g.chown -R www-data:www-data) plus 755/775 — not opening the door to the entire machine. - Never
chmod -R 777a tree. It makes every data file, config, and image both world-writable and executable, and on many systems flags them to security scanners. Recovering correct modes afterward is painful; the damage to secrets is immediate.
777 vs the alternatives
- 755 (
rwxr-xr-x) is what people actually want when they type 777: owner can write, everyone else can read and run, nobody else can modify. For directories and scripts this is the safe default — reach for it first. - 775 (
rwxrwxr-x) grants write to the owner and a trusted group but not the world — the correct answer for a directory a deploy team or web group must write to. It keeps others read-only instead of writable. - 666 (
rw-rw-rw-) is 777 without the execute bits — still world-writable and just as unsafe for the same reasons, but for plain data files rather than programs/directories.
Set it with chmod
Apply this permission to a single file:
chmod 777 filename
Or apply it recursively to a directory and everything inside it:
chmod -R 777 directory/
The same thing in symbolic form:
chmod u=rwx,g=rwx,o=rwx filename
Frequently asked questions
What does chmod 777 mean?
chmod 777 sets rwxrwxrwx: the owner, the group, and every other user on the system can read, write, and execute the file or directory. It is the most permissive setting that exists.
Is chmod 777 safe?
No. It lets any user or process on the machine modify, replace, or delete the file. On shared hosts and web servers it is a well-known security hole. Use it only on a private, single-user temp path, if at all.
Why do tutorials tell me to use 777 to fix a permission error?
It's lazy advice. 777 silences the error by removing all restrictions, but the real cause is almost always wrong ownership. The correct fix is to chown the path to the right user/group and use 755 or 775.
What should I use instead of 777?
755 for directories and scripts, 644 for data files, 775 for a directory a specific group must write to, and 1777 (sticky) for a genuinely shared temp directory. Match ownership to the process that needs access rather than opening it to everyone.
Other common permissions
Or build any permission with the interactive chmod calculator.