What is chmod 777? How to change file permissions for Linux?

chmod 777

Not specifically for Linux, you can also face this error while uploading files on your website server. In Linux, you can meet this issue while uploading or modifying any file in your system. But what is chmod 777, and why it is happening in the first place? Well, in this article you will get to know the solution as well as complete information about this error, what is the meaning of chmod 777?

First of all, let’s take a look at the quick solution for this error.

Solution – Changing File Permissions

To solve this error, you have to change the permissions for that file, no matter if it is on the web or in your Linux.

Here are the steps to follow to solve this issue.

  • Right-click on the file that is having chmod 777 “You do not have the permissions to upload file to the folder” error.
  • Now open the properties tab, and change owners, Group, and other permissions to “Read and write” like seen in the screenshot below.
Read and write Permissions
Read and write Permissions

Changing File Permissions in Web Hosting

When you receive permission error while uploading any file on the webserver, then get alerted that this is because of 777 permissions.

You can change the permissions by the following process.

  • Right-click on the file and click on Change Permissions from the menu.

    Change Permissions
    Change Permissions
  • Now click on all permission.

    Set 777
    Set 777
  • Now save changes, and you are good to go.

Now let’s get some knowledge about this chmod 777 thing.

Understanding File Permissions for Unix?

To understand this better, you can also watch this Youtube Video.

Linux and Mac OS X comes with a great feature of permission control, using that reading and writing ability of that file can be controlled. But the fun part is that you can also control who can manage it, and what permissions will be given to that person is also in your hands.

If you name them, the Classes are those who determine who has access to that file. And Permissions are the type of access that the person has. Classes are of three types, or you can say that the permissions can be divided into three groups of persons that can have a specific set of accesses.

Permission Classes
Permission Classes

In the above picture, you can see the three classes, owner, group, and others.

  • The owner is the person who created or placed the file there. It can be a file or a folder. The files that you get from other devices may have different ownership.
  • The group is the set of people or computer users that has the same kind of permission.
  • Others are the users- logged in as a guest or the general public.

Now come to the Permissions. There are three types of permissions that you can have or assign to the classes (we have mentioned above.)

  • Read: Under this permission, the class that has this permission can only view the file and can not modify or edit that.
  • Write: Under this permission, the class that has this permission can read the file and also can modify, edit, or delete the file and folders.
  • Execute: As the name suggests, under this permission only, a class can run or execute a script or a file.

In this way, as an owner, you can make a class first, and then you can assign them their permissions.

As an owner, you have all the permissions like reading, write, and execute. But you can also assign or change the permissions of the other classes.

What are the 777 permissions? Why not 888?

Good question! Well, to understand this number game, you have to learn some basic rules that are used for assigning these numbers.

If you are familiar with the binary numbers, then you can get this better. When you create a file folder, no matter what size the file has, it is encrypted by 8-bit data. When it has no permission, it can be written as “000”, but when you assign the read permission, it adds a 4-bit of more data. And it becomes “100”.

Adding 2-bit more data by giving the write permission, it becomes “010”, and lastly, adding the execute permissions make it “001”.

Moreover, Read has the equivalent value to 4 in binary decimal numbers, write has the equivalent value to 2 in decimals, and execute permission has the equivalent to 1.

When we assign the permissions, then we add the number, and that is what we use as a code. For example, for all the permission, we will add the decimal points of all. So, 4+2+1= 7. Did you get it now? Right! This was the whole number game. Moreover, you can get more details in the image below.

Range
Range

If you want to use or remember the codes, here is a list of all the codes and their assigned permissions in the image below. You can also change the number to assign a different set of permissions to a file or folder.

Permission authority
Permission authority

Now, the only thing that remains is the three numbers mystery. Well, this is not a mystery; it is already mentioned in the article. The first digit is for the class “owner,” 2nd digit is for the “group,” and the 3rd digit is for the “others.” And now, when all the three are 7, that means all the classes have all the information.

In the image below, you can see all the possible combinations of the three numbers that are used.

Permissions Defined
Permissions Defined

Conclusions:

It is just a simple number game. Better understand that, and you can get to know why it is 777. Well, to quickly solve the problem, you can change the permissions from the properties.

Related Posts