Linux File Permissions
Every file has an owner. Most likely it is the user who created that file, although that can change. Users can be grouped together to from groups for many purposes. Another element is, who has permission to use the file. These are split into three areas:
- Who can read (view) the file
- Those who can write to the file
- Who can execute (run) the file
Each file has three sets of permissions: permissions for the owner of the file, permissions for the group the file is assigned to, and permissions for all other users on the system.
Let’s take a look at some files to see what we see. Linux treats most things as files, from lowly text files to executable files (programs), they are all the same.
|+ (Adds a permission)
|– (Removes a Permission)
|= (Makes permission equal to)
There are two ways of using chmod to get the same results.
Using letters with chmod
The first way is to use it with the chart above.
Note: do not use space in between
Using numbers with chmod
The other way is to use numbers to represent read, write and execute. Each one can add up to seven (4+2+1 = 7). Seven gives that entity full permissions to do anything to that file.
Going with our example above we would write:
Doing it in the GUI
Open the folder containing the document and right click and go to properties -> permissions. There you can fine-tune the permissions and make it executable if so desired.
Knowing about file permissions will save you a lot of headaches in the long run. Most problems that you will run into are just a lack of permission to either read, write or execute something. This article is just a brief overview of file permissions to give you an idea of somethings you can do. As with all things there are always more things to learn.