What is CHMOD 777
lets talk about “777”, “775” and what this means as now you must be clear about the Classes and Permissions.
Every file and folder contain a 8-bit data that control the permissions. At its basic binary form, it will be “000”, which means no permissions of any form is granted. When you set a “Read” permission, it will add 4-bit to the data, making it “100” (in binary format) or a “4” in the usual decimal format. Applying 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. When we sum it up :
- Read is equivalent to ‘4’.
- Write is equivalent to ‘2’.
- Execute is equivalent to ‘1’
Lets set some Permissions by adding up the numbers. For instance, to set the permissions to read and write, we will use ‘6’ (4 + 2) for the permission. For read, write and execute, we will use ‘7’ (4 + 2 + 1) for the permission. Here’s the detailed breakdown:
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
You set the number as per the permissions you want to allocate a file or folder.
So What about three digits i.e. 777 ? First digit is assigned to the Owner, Second digit is assigned to the Group and third digit is assigned to the Others. So for a file with ‘777’ permission, everyone can read, write and execute the file. Some commonly used CHMOD permissions in Linux :
- 755 – This permission is mostly used in web server. Owner has all the permissions to read, write and execute. Everyone else can only read and execute, but cannot write to the file (make changes).
- 777 – Everyone can read write and execute. It is not advisable to set ‘777’ permission in a web server for your files and folders as it allows anyone to add bad code to your server (Hackers love such misconfigured permissions). However, in some cases, you will need to set the 777 permissions before you can upload any file to the server (For example, uploading images in your website)
- 644 – Only the owner can read and write. Everyone else can only read. No one can execute the file.
- 655 – Only the owner can read and write, but not execute the file. Everyone else can read and execute, but cannot modify the file.
How to CHMOD permissions in Linux
You can easily change the file permissions in Linux by just right-clicking the file or folder and select “Properties”. There will be a Permission tab where you can change the file permissions. You might not get a desktop interface if you have hosting , but you can achieve the same in your Hosting File Manager. You can also set permissions using a terminal, Command to use to change file permission is “
". Basically setting a “chmod 777” means making the file readable, writable and executable by everyone.
chmod 777 /path/to/your/file
Hopefully after reading all this you have a better understanding about CHMOD and what CHMOD 777 is and how they work in Linux environment.