What Does chmod 777 Mean

You are trying to fix a permission issue with your web server and found a suggestion to recursively run chmod 777 on the web directory. Before doing that, make sure you understand what chmod -R 777 does and why you should never set permissions to 777.
chmod 777 sets read, write, and execute permissions for the owner, the group, and everyone else on the system. In symbolic form, it is rwxrwxrwx. It lets any user on the machine read, modify, or execute the file, which is why you should never use it on production directories or web roots.
This guide explains the Linux permissions model, what 777 means, and how permission numbers work. For a deeper walkthrough of chmod, see our chmod guide .
Understanding Linux File Permissions
In Linux, access to the files is controlled by the operating system using file permissions, attributes, and ownership. Understanding the Linux file system permissions model allows you to restrict access to files and directories only to authorized users and processes and makes your system more secure.
Each file is owned by a particular user and a group and assigned permission access rights for three different classes of users:
- The file owner.
- The group members.
- Others (everybody else).
Three file permission types apply to each user class, and allow you to specify which users are allowed to read, write to, or execute the file. The same permission attributes apply for both files and directories with a different meaning:
- The read permission.
- The file is readable. For instance, when the read permission is set, the user can open the file in a text editor or display the file content in the terminal.
- The content of the directory can be viewed. The user can list files inside the directory with the
lscommand.
- The write permission.
- The file can be changed or modified.
- The content of the directory can be altered. The user can create new files , delete existing files , move files , rename files , etc.
- The execute permission.
- The file can be executed. The user can run the script or binary from the command line.
- The directory can be entered using the
cdcommand.
File permissions can be viewed using the ls
command. Here is an example:
ls -l filename.txt-rw-r--r-- 12 linuxize users 12.0K Apr 8 20:51 filename.txt
|[-][-][-]- [------] [---]
| | | | | | |
| | | | | | +-----------> 7. Group
| | | | | +-------------------> 6. Owner
| | | | +--------------------------> 5. Alternate Access Method
| | | +----------------------------> 4. Others Permissions
| | +-------------------------------> 3. Group Permissions
| +----------------------------------> 2. Owner Permissions
+------------------------------------> 1. File TypeThe first character indicates the file type. It can be a regular file (-), directory (d), a symbolic link
(l), or any other special type of file.
The following nine characters represent the file permissions, three characters for each user class. The first triplet shows the owner permissions, the second group permissions, and the last one shows the permissions for everyone else.
Permission Numbers
File permissions can be represented in either numeric or symbolic format.
The permission number may consist of three or four digits, ranging from 0 to 7.
When using a 3-digit number to represent file permissions, the first digit corresponds to the owner’s permissions, the second digit to the group’s permissions, and the third digit to everyone else’s permissions.
The read, write, and execute permissions have the following number value:
r(read) = 4w(write) = 2x(execute) = 1- no permissions = 0
The permissions digit of a specific user class is the sum of the values of the permissions for that class.
Each digit of the permissions number may be a sum of 4, 2, 1, and 0:
- 0 (0+0+0) – No permission.
- 1 (0+0+1) – Only execute permission.
- 2 (0+2+0) – Only write permission.
- 3 (0+2+1) – Write and execute permissions.
- 4 (4+0+0) – Only read permission.
- 5 (4+0+1) – Read and execute permission.
- 6 (4+2+0) – Read and write permissions.
- 7 (4+2+1) – Read, write, and execute permission.
For instance, if the permission number is set to 750, it means the file’s owner has read, write, and execute permissions. The file’s group has read and execute permissions, while other users have no permissions:
- Owner: rwx=4+2+1=7
- Group: r-x=4+0+1=5
- Others: —=0+0+0=0
When a 4-digit number is used, the first digit represents special permissions:
- setuid = 4: When set on an executable, it runs with the file owner’s privileges.
- setgid = 2: When set on an executable, it runs with the group’s privileges. When set on a directory, new files inherit the directory’s group.
- sticky = 1: When set on a directory, only the file owner can delete or rename files within it (commonly used on
/tmp). - no changes = 0
For example, to set the sticky bit on a shared directory:
chmod 1777 /tmpThe next three digits have the same meaning as when using a 3-digit number. If the first digit is 0, it can be omitted, and the mode can be represented with 3 digits. For example, the numeric mode 0755 is the same as 755.
To view the file’s permissions in numeric (octal) notation, you can use the stat
command:
stat -c "%a" filename644Never Use chmod 777
Setting 777 permissions (chmod 777) to a file or directory means that it will be readable, writable, and executable by all users and is a serious security risk.
For instance, if you recursively change the permissions of all files and subdirectories under the /var/www directory to 777, any user on the system can create, delete, or modify files in that directory.
If you experience permission issues with your web server, instead of recursively setting the permission to 777, change the file’s ownership to the user running the application and set the file’s permissions to 644 and the directory’s permissions to 755.
Remember that directories need execute (x) permission to be accessed, so safe defaults differ for files (644) and directories (755).
File ownership can be changed using the chown
command and permissions with chmod.
Suppose you have a PHP application on your server running as user “linuxize”. To set the correct permissions, you would run the following:
chown -R linuxize: /var/www
find /var/www -type d -exec chmod 755 {} \;
find /var/www -type f -exec chmod 644 {} \;Only the root, the file owner, or the user with sudo privileges can change the permissions of a file. Be extra careful when using chmod, especially when recursively changing the permissions.
Understanding umask
The umask value controls the default permissions for new files and directories. It subtracts permissions from the system defaults. For example, a common umask of 022 results in:
- Files:
644(read/write for owner, read-only for group and others) - Directories:
755(read/write/execute for owner, read/execute for group and others)
To view the current umask:
umaskNumeric vs Symbolic Format
You can also set permissions using the symbolic format. Instead of numbers, it uses letters (u for owner, g for group, o for others, a for all) combined with +, -, or =:
chmod u+rwx,g+rx,o+rx filenameThis is equivalent to chmod 755 filename. The symbolic format can be more readable when you want to change specific permissions without affecting others:
chmod g+w filename
chmod o-x filenameCommon Permission Examples
Here are some commonly used permission settings and their typical use cases:
| Permission | Numeric | Meaning | Common Use |
|---|---|---|---|
-rwx------ | 700 | Owner can read, write, execute | Private scripts, home directories |
-rwxr-xr-x | 755 | Owner can read, write, execute; group and others can read and execute | Directories, executable scripts |
-rw-r--r-- | 644 | Owner can read, write; group and others can read | Regular files, web content |
-rw-rw-r-- | 664 | Owner and group can read, write; others can read | Shared project files |
-rw------- | 600 | Owner can read, write | Private configuration files, SSH keys |
-rw-rw---- | 660 | Owner and group can read, write | Shared sensitive files |
-rwxrwxrwx | 777 | Everyone can read, write, execute | Never recommended |
Quick Reference
For a printable quick reference, see the chmod cheatsheet .
| Task | Command |
|---|---|
| View permissions (symbolic) | ls -l filename |
| View permissions (numeric) | stat -c "%a" filename |
| Set permissions | chmod 755 filename |
| Set all directories recursively | find /path -type d -exec chmod 755 {} \; |
| Set directories to 755, files to 644 | find /path -type d -exec chmod 755 {} \; and find /path -type f -exec chmod 644 {} \; |
| Change ownership | chown user:group filename |
FAQ
What does chmod 777 do?
It sets read, write, and execute permissions for the owner, group, and all other users. This means anyone on the system can read, modify, or execute the file.
When is it OK to use chmod 777?
Almost never in production. It is sometimes used temporarily for debugging permission issues, but the permissions should be reverted immediately after. For web directories, use 755 for directories and 644 for files.
Does sudo chmod 777 do something different from chmod 777?
No. sudo only lets you run the command as a privileged user when you do not own the file. The 777 part still grants the same wide-open permissions to every account on the system, so reaching for sudo does not make 777 any safer.
Is chown 777 the same as chmod 777?
No. chown changes file ownership and does not accept permission numbers like 777. To change permissions, use chmod. To change the user or group that owns a file, use chown
.
What is the difference between chmod 755 and chmod 644?755 allows the owner to read, write, and execute, while group and others can read and execute. 644 allows the owner to read and write, while group and others can only read. Use 755 for directories and executable files, and 644 for regular files.
How do I check the current permissions of a file?
Use ls -l filename to see the symbolic format (-rwxr-xr-x) or stat -c "%a" filename to see the numeric format (755).
Conclusion
You should never set 777 (rwxrwxrwx) permissions on files and directories, since it gives anyone with an account full control over those files. Reach for 755 on directories and 644 on files, and only loosen them when a specific user or group genuinely needs more.
Tags
Linuxize Weekly Newsletter
A quick weekly roundup of new tutorials, news, and tips.
About the authors

Dejan Panovski
Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.
View author page