Analyze file permissions in Ubuntu

In this article, we would discuss various file permission combinations in Ubuntu distribution. If you want to know how to set file permissions as per our requirements. Then follow the article here – Set permissions on files & directories using chmod in Ubuntu.

In an organizational setup, we can’t provide access to the each and every file/directory to all the users. So, a user would have a limited access to system resources. There could be numerous reasons, generally it is done for –

  1. keeping our system secure and,
  2. making efficient use of the resources available.

This is done even when we share our system with someone else (i.e. at an individual level).

Just consider a scenario wherein you have been working on something of significance which is yet to release in the market. And, you don’t want others to know about it beforehand. Although there are other ways to secure things around. But, this we discuss just as an example. File permissions could be a potential way out. We provide read, write and execute access to certain users and completely barring other who don’t belong to a particular group.

File permissions in Ubuntu

So, first understand how things work for different users and groups. Open a terminal and issue the following –

ls -al ~

The output would resemble something like below. Although, things may seem a bit different depending on your Systems’ configuration.

-rw------- 1  techpiezo techpiezo 1076 Apr 14 21:47 .bash_history
-rw-r--r-- 1  techpiezo techpiezo 220  Nov 30 20:35 .bash_logout
-rw-r--r-- 1  techpiezo techpiezo 3815 Apr 6 18:03  .bashrc
drwx------ 13 techpiezo techpiezo 4096 Apr 5 10:33  .cache
drwx------ 20 techpiezo techpiezo 4096 Apr 13 15:48 .config
drwxr-xr-x 2  techpiezo techpiezo 4096 Jan 1 09:42   Desktop

We would directly start with the permissions. For instance,

-rw-r--r-x

If the first character is r, then it indicates read permissions granted. Similarly, the second character is w, write permissions. And, lastly x, execute permissions.

Ignore the first – above for a while, and focus on the rest. If is in places where r,w and x is there. Then, those particular file permissions aren’t granted.

This would be clear with following example –

rwx

All three permissions are granted.

r-x

Only, read and execute permissions are granted. And, similarly for other combinations.

But, one may ask why there are three set of permissions. Since, rwx or related combinations appear thrice.

The first set of rwx corresponds to the user, who owns the file. The second set is for the user group. And, the third is for others (i.e. everyone else).

That way, we can decide which permissions we need to enable for a specific user.

In conclusion, we have discussed file permissions in Ubuntu. In coming article, we would cover special file permissions.

Similar Posts