If you are webmaster managing your own website on a Linux Server ,You must have faced this error message “You do not have permission to upload or create files here” . After some googling, the solution is “CHMOD to 777″ or CHMOD to 775” . You might be wondering what “777” mean? And why must it be ‘7’, and why not ‘8’ or ‘9’?
What is CHMOD
On Linux, there is a set of rules for each file which defines who can access a particular file and how they can access it. These rules are known as “File Permissions” or “File Modes”. The word CHMOD stands for “Change Mode“. Its a syntax with which users can change file permissions which i will explain below.
CHMOD File Permissions
Linux / Unix come with a file control mechanism to allow who can access a particular file or folder and what actions that user can perform. There are two parts to the file control mechanism : Classes and Permissions. Classes tell who can access the file while the Permissions determine the kind of action the user can perform on the said file.
There are three type of Classes – Owner, Group, Others.
- Owner is the creator of the files/folders. In Linux, files or folders that you created owned by you, unless you specifically change the ownership.
- Group contains a group of users who share the same permissions and user privilege, these are generally the server roles aswell
- Others means the public.
Permissions are also of three types – Read , Write , Execute.
- Read – Only view files but cannot modify the content of the file. When this is applied on a Folder, you can only view the files inside the folder but can’t delete or add files into the folder.
- Write – Can edit and modify the file. For Folders you can delete and add files into the folder.
- Execute – Execute is mainly used when you need to run the file (commonly used when you need to run a script). Mostly required with Upload scripts etc
With Classes and Permissions combined we are able to control who can access the file and what actions they can perform on those files / folders