Those who have used a Unix-based operating system are probably familiar with the term Chmod 777. However, you may not know exactly what it means and how to use it. There is no reason to worry, here we will take a closer look at this term to help you clarify things. Let’s start by saying that Chmod is the command and system call in Unix based OS, which is used to change the access permission to file and directories. If you attempt to edit a file or upload data into a directory, you may see an error stating that there is no permission for the file. Let’s take a closer look at Chmod 777 and its meaning in Unix.
What is Chmod 777?
It is important to note that in Unix based OS, there are two main aspects to note for files and their permissions. The first is the class of users that are able to access the file and the second is the kind of permissions available for each class of users. There are three different classes of users to note: Owners, Groups and Others. As the name suggests, Owners are the users who own the files and can edit them. Groups refers to group of users and like the owners, they have permissions to edit files. “Others” refer to general users who have limited access.
When it comes to permissions, there are three types to keep in mind: Read, Write and Execute. Read mode only provides permission to read the content of the file. In order to be able to edit a file, you need Write permission. To run the script of the file, you will need execute permissions. The access to a file is determined by the classes and permissions. Read is the same as 4-bit data and as such it is usually refereed to as 4. Since Write command is 2-bit data, it is mentioned as 2, while Execute is 1 bit. It should be noted that there are different combinations of Read, Write and Execute.
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
The number 7 in Chmod involves read, write and execute permission, but to understand why there are three 7’s in Chmod, we need to keep in mind the classes of users. We mentioned before that we have: Owners, Groups and Others. The three 7’s in Chmod refer to these three classes of users. The first 7 refers to Owners, the second to Groups and the third to Others. In essence, chmod 777 indicates that owners, groups and others have permissions to read, write and execute files. Below, you will see some combinations and what they mean.
- Chmod 777 – Read, write and execute for owners, groups and others
- Chmod 755 – Read, write and execute for owners, read and execute for groups and others
- Chmod 655 – Read and write for owners, read and execute for groups and others
There are also combinations based on your requirement for the file and directory.
Using Chmod 777
Once you have set the permissions for the file for each class, you will be able to launch the Chmod command, entering the below command line:
CHMOD 777 [FILE LOCATION AND NAME]
As an alternative, it is possible to select the file and then click properties and choose the permission for the file or directory.