Understanding File Permissions: What Does “Chmod 777” Mean?

Chmod Permissions Linux Macos

If you’re a Linux user or a system administrator managing a Linux server, you’ll come across the “You do not have the permissions to upload file to the folder” error. After some Googling, the solution is often as easy as setting the file permission to “775” or “777.” In technical terms, you will be asked to “chmod 777 the file.” But what does “777” mean? And why must it be “7” and not “8” or “9”?

In this post, we show you how to understand file permissions a little better, including what chmod 777 means.

Also read: How to Easily Rename Files in Linux

Understanding File Permissions

Unix systems (including Linux and macOS) have a file control mechanism that determines who can access a particular file or folder and what they can do with it.

There are two parts to consider:

Classes. This determines who can access the file. There are three designations: an Owner, a Group (who all share the same permissions), and Others.

  • The Owner is usually the creator of the file or folder. In Linux, any files or folders that you create in your Home directory are usually owned by you unless you specifically change the ownership.
  • The Group contains a group of users who share the same permissions and user privilege.
  • Others means the general public.
You can view Linux's file permissions.

Permissions. These determine what the user can do with a file. You can either Read, Write, or Execute a file, and you’re able to set almost any combination of these three permissions.

  • Read. You cannot modify the contents of the file in any way. When applied to a Folder, you can only view the files within that folder; you cannot delete or modify the files in any way or add more files to the folder.
  • Write. You can modify the file. If you have “write” access to a folder, then you can delete and add files to that folder.
  • Execute. Execute is mainly used when you need to run the file and is most commonly used when you need to run a script.
The "Access" dropdown displays the current file permissions.

By using Classes in combination with Permissions, you can control who has access to a file and the actions they can perform.

The file owner will often have all three permissions available to them (read, write and execute). If you’re unable to upload a file to a server, it’s often because of mismatched permissions.

Explaining File Permission 777

Once you have a basic understanding of Classes and Permissions, you can begin to understand numbers such as “777” and “775.”

Every file and folder contains 8-bit data that controls the permissions. In its basic binary form, 000 means that no permissions of any form are granted.

When you set a “Read” permission, it adds 4-bit to the data, making it “100” (in binary format) or a “4” in the usual decimal format. Setting a “Write” permission will add 2-bit to the data, making it “010” and “2” in decimal form. Lastly, setting an “Execute” permission adds 1-bit to the data, which will result in “001,” or “1” in decimal form. In short:

  • Read is equivalent to “4.”
  • Write is equivalent to “2.”
  • Execute is equivalent to “1.”

In a nutshell, setting permissions is basic math. For example, to set “Read and Write” permissions, we combine 4 and 2 to get 6. Of course, there are other permutations:

  • 0: No permission
  • 1: Execute
  • 2: Write
  • 3: Write and Execute
  • 4: Read
  • 5: Read and Execute
  • 6: Read and Write
  • 7: Read, Write, and Execute

A complete set of file permissions assigns the first digit to the Owner, the second digit to the Group, and the third to Others. Here are some of the commonly used permissions:

  • 755. This set of permissions is commonly used by web servers. The owner has all the permissions to read, write and execute. Everyone else can read and execute but cannot make changes to the file.
  • 644. Only the owner can read and write. Everyone else can only read. No one can execute this file.
  • 655. Only the owner can read and write and cannot execute the file. Everyone else can read and execute and cannot modify the file.

As for 777, this means every user can Read, Write, and Execute. Because it grants full permissions, it should be used with care. However, in some cases, you’ll need to set the 777 permissions before you can upload any file to the server.

Setting File Permissions in Command Line

In Linux, you can easily change the file permissions by right-clicking a file or folder and selecting “Properties.” This will open a Permission tab where you can make changes.

In contrast, you can change permission settings on macOS by right-clicking and selecting “Get Info.” Here, you can expand the “Sharing & Permissions” section and make your changes.

The Get Info panel, showing permissions.

To make modifications, select the relevant permissions from the Privilege section and choose something more suitable.

Setting new file permissions for a file in macOS.

Though, this isn’t the only way you can change file permissions. Let’s explain this in more detail next.

Changing File Permissions Using chmod 777

If you’re more familiar with the Terminal and Command Line, you can also change permissions here, too.

The chmod command lets you “change the mode” – another way to describe access permissions. To do this, open the Terminal and type the following:

chmod 777 /path/to/file

In short, chmod 777 combines the two concepts we’ve presented throughout this article. It means to make the file readable, writable and executable by everyone with access. As such, it’s a powerful and a potential system-breaker – so extra care should be taken with it.

In Summary

File permissions can present you with a roadblock if they’re not set correctly. This is by design, as a locked down system can’t be compromised. Though, if you’d like to access a file on your system or server, learning how to change certain permissions is a solid skill to have.

In a nutshell, chmod 777 is the command you’ll use within the Terminal to make a file or folder accessible to everyone. You should use it on rare occasions and switch back to a more restrictive set of permissions once you’re done.

If you’re wondering what else the Terminal can do, check out our post on how to copy and paste from the command line. Do you have to manage file permissions, and will this post help you? Let us know in the comments section below!

Subscribe to our newsletter!

Our latest tutorials delivered straight to your inbox

Tom Rankin

Tom Rankin is a quality content writer for WordPress, tech, and small businesses. When he's not putting fingers to keyboard, he can be found taking photographs, writing music, playing computer games, and talking in the third-person.