| Tested on | RHEL 10.2 (Coughlan) |
|---|---|
| Package | chmod (GNU coreutils) 9.5-8.el10_2 |
| Applies to | RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, Fedora, Debian, Ubuntu, and other Linux distributions with GNU coreutils |
| Privilege | File owner, or root/sudo where ownership or filesystem restrictions require elevated privilege |
| Scope | What chmod 777 means on files and directories, why it is dangerous, a short note on chmod -R 777, safer alternatives, and 777 vs 755. Does not cover the full chmod tutorial, symbolic modes, setuid, or ACLs. |
| Related guides | chmod command cheat sheet Linux file permissions Linux sticky bit chown command Linux ACL examples |
chmod 777 FILE gives the file or directory read, write, and execute (or search) permission to owner, group, and everyone else:
Owner = rwx
Group = rwx
Others = rwxIn symbolic form that is rwxrwxrwx. Each 7 is 4 (read) + 2 (write) + 1 (execute). GNU Coreutils defines the three octal digits as permissions for owner, group, and other users, with 7 representing all three bits.
Although 777 can sometimes make a Unix mode-bit permission problem disappear, it normally grants much more access than the application actually needs.
Quick reference: chmod 777
| Command | Meaning |
|---|---|
chmod 777 file |
Give everyone read, write, and execute |
chmod 777 directory |
Give everyone read, write, and directory traversal |
chmod -R 777 directory |
Apply 777 recursively to the entire tree |
chmod 755 directory |
Owner writes; everyone can read and traverse |
chmod 644 file |
Owner writes; everyone can read |
chmod 775 directory |
Owner and group write; others read and traverse |
What does chmod 777 mean?
Octal chmod modes use three digits — owner, group, and others. The command maps like this:
chmod 777 file
│││
││└── Others: rwx
│└─── Group: rwx
└──── Owner: rwxEach digit is the sum of permission bits:
| Number | Permission |
|---|---|
| 4 | read |
| 2 | write |
| 1 | execute |
| 7 | read + write + execute |
So 777 means every class gets all three bits — -rwxrwxrwx on a file or drwxrwxrwx on a directory. Here, "others" means users who are not the owner and whose access is not being granted through the file's group class. For the full permission model see Linux file permissions.
chmod 777 on a file vs directory
777 sets the same bits in both cases, but read, write, and execute mean different things depending on whether the path is a file or a directory.
File
Apply 777 to a script so everyone can read, change, and run it:
chmod 777 script.shchmod exits silently on success, so confirm the mode with ls:
ls -l script.sh-rwxrwxrwx. 1 root root 20 Aug 16 14:36 script.shThe leading - marks a regular file with rwx on all three classes.
Directory
On a directory, r lets users read the directory listing, w permits changes to directory entries such as creating, removing, or renaming files, and x permits lookup and traversal. With 777, all three permissions are granted to owner, group, and others.
chmod 777 shared/Check the directory mode the same way:
ls -ld shared/drwxrwxrwx. 2 root root 6 Aug 16 14:36 shared/The leading d marks a directory. Because 777 sets r, w, and x for every class, any user who can reach the path gets listing, traversal, and entry-management access.
Why is chmod 777 dangerous?
The core problem is the third digit — others = rwx. That removes the permission boundary between the intended owner or group and every other local account that can reach the path.
On a web application tree, another local user or service may be able to change files or drop scripts — not because "hackers can execute anything," but because the mode allows it. 777 is a poor fix for "Permission denied" because it trades a narrow access problem for world-writable exposure.
What does chmod -R 777 do?
The -R flag tells chmod to walk the whole directory tree and apply one mode everywhere:
chmod -R 777 /path/to/directoryGNU chmod -R recursively changes the directory and everything beneath it, applying the same rwxrwxrwx mode to directories, files, scripts, and configuration alike. That is usually worse than a single chmod 777 because every nested file becomes writable and executable by everyone. It also adds the execute bit to ordinary files that were never intended to be programs, while giving every user write access to configuration, content, and scripts throughout the tree. Undoing it requires knowing each path's previous mode.
For recursive workflows and safer tree fixes, see the chmod command cheat sheet.
What should you use instead of chmod 777?
Pick the narrowest mode that matches who actually needs access:
| Requirement | Typical permission |
|---|---|
| Normal readable file | 644 |
| Publicly executable script | 755 |
| Script executable only by owner | 700 |
| Script readable but not directly executable | 644 |
| Public directory | 755 |
| Private file | 600 |
| Private directory | 700 |
| Shared group file | 664 |
| Shared group directory | 775 |
When an application cannot write a directory, inspect ownership and traversal before reaching for 777. Start with the directory itself:
ls -ld /path/to/directoryIf the path looks correct but access still fails, walk each parent with namei to see which component blocks traversal:
namei -l /srv/private/appf: /srv/private/app
dr-xr-xr-x root root /
drwxr-xr-x root root srv
drwx------ root root private
drwxr-xr-x app app appprivate has 700, so users other than root cannot traverse into app even if app itself has permissive permissions. The problem is often wrong owner (chown), wrong group (chgrp), missing group write (664 / 775), or missing traverse on a parent directory. Those fixes address the real issue without leaving the path world-writable.
chmod 777 vs chmod 755
777 = rwxrwxrwx
755 = rwxr-xr-xSide by side:
Owner Group Others
777 rwx rwx rwx
755 rwx r-x r-xWith 755, only the owner can write; group and others get read and traverse on directories (or read and execute on files). That removes world write compared with 777 and can suit a public directory or a script that genuinely needs to run for every user who can reach it — but it is not a universal default. Private data still belongs in 600 or 700, and owner-only scripts often need 700 instead.
Is chmod 777 ever appropriate?
Occasionally, in an isolated lab or a deliberately world-writable drop folder, wide-open permissions are intentional — but treat 777 as temporary.
Do not treat plain 777 as normal because /tmp is world-writable. Typical /tmp uses 1777, not 777:
stat -c '%a %n' /tmp1777 /tmpThe leading 1 is the sticky bit — users can create files in /tmp but cannot delete each other's entries. See Linux sticky bit for the full behavior.
References
Summary
chmod 777 sets rwxrwxrwx — owner, group, and others all get read, write, and execute or search permission. The mode is dangerous because the others digit grants write to every account that can reach the path, and chmod -R 777 spreads that exposure through an entire tree.
When Permission denied appears, check owner, group, and parent-directory traversal with ls -ld and namei -l before defaulting to 777. Narrow fixes — 644, 755, 664, 775, chown, or chgrp — usually match real application needs. World-writable paths like /tmp use 1777 with the sticky bit, which is not the same as plain 777.

