Whether you are using shared hosting, a VPS, or a dedicated server, there is a good chance that you will eventually use Linux, unless you specifically chose a Windows or other Unix-like server. Most web hosts today offer Linux for their standard hosting packages and therefore use Linux file permissions for files. Fortunately for you, the file permission system for Linux is very easy to use.
In Linux there are three types of ownership designations: owner (or user), group, and others (or world). There are also three levels of permissions: read, write, and execute. Those are the only six terms you need to know. With that knowledge, you can tell who is the owner of a file and who has permissions to read, write, and/or execute the file.
From the command line or file manager, the permissions for a file will look something like this:
-rw-rw-r– 5 sandy sandy 20480 05:38 index.html
The file “index.html” is owned by the user “sandy” and also in sandy’s group. The permissions are:
- user/owner: read, write
- group: read, write
- others: read
This means that Sandy and anyone in her user group can modify the file, but everyone else can only view it. This might make sense for a web file, since the world needs to view it but certainly should not have the ability to change it.
Another example would be:
-rwxrwxr-x 1 morpheus morpheus 74 Mar 20 2012 runtime-script
In this example the permissions for a file owned by morpheus are:
- user/owner: read, write, execute
- group: read, write, execute
- others: read, execute
This file is fully executable, so it must be a script or application. Everyone can execute it, but only the owner and group can edit it.
Linux file permissions are simple enough to learn quickly but also powerful enough to protect your files, while still giving limited access to others when needed. For more detailed information about Linux file permissions, you can read this comprehensive tutorial on the web.