Linux File Permissions

Linux File Permissions

This article is about Linux File Permissions and how to change them using the chmod command.  Linux permissions are split into two areas: File ownership and File access 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.

Category Operation Permission
u (User) + (Adds a permission) r (Read)
g (Group) (Removes a Permission) w (Write)
o (Other) = (Makes permission equal to) x (Execute)

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.

In Conclusion

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.

How useful was this post?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.



Updated on October 28, 2021