Sunday, 6 October 2019

Understanding Chmod 777

One of the very common error , students face day to day is

       "You do not have the permissions to upload file to the folder

And as most of you aware that, chmod 777 <directory_name>  is the command that gives you permission to Read/Write/Execute the the content of the folder , this article is about the number 777. Yes, what does it mean by the number 777 in the chmod ?

Each folder will have an 8-bit data for granting permissions. By default, 000 means, no permission is available. By granting Read permission, 4 bits are added to the data. By providing Write permission, 2 bits are added to the data. By providing execute permission, 1 bit is added to the data. So totally it's 7.

Now, immediately follow-up question is why 777?

First digit 7 grants permission to the owner
Second digit 7 grants permission to the group
Third digit 7 grants permission to others