How To Check File Permissions in Linux OS

Affiliate disclosure: In full transparency – some of the links on our website are affiliate links, if you use them to make a purchase we will earn a commission at no additional cost for you (none whatsoever!).

Linux system OS uses a authorizations schema to determine customer privileges for each computer file. These authorizations establish:

  • who can study the computer file? If the computer file is a listing, the study indicates record the material of the listing.
  • who can write/modify the computer file? If the computer file is a listing, this authorization describes if you can make any changes to the listing material, for example, make or remove information.
  • who can perform the computer file? If the computer file is a listing, this authorization describes if you can get into the listing and access its material, for example, run a search in the listing or perform a program in it.

Permissions are allocated to the computer file proprietor, to the computer file proprietor team, and to all customers. For example, you can set a paper to be understandable and writable by the proprietor only, and just understandable by everybody else.

When you issue an ls –l control, to record all material of a listing, you will see computer file authorizations like this next to each file:

-rwxrwxrwx

This indicates this computer file can be studied, published and implemented by anybody. The first sprint indicates this computer file is not a listing. For internet directories, there will be a correspondence instead of a sprint.

The first set of “rwx” represents the computer file proprietor. The second set, to the proprietor team. The last set, to all other customers. Let us look at some examples:

-rwxr – – r – –

This computer file can be studied, published and implemented by its proprietor. It can only be studied by other customers. When authorization is not set, you see a sprint in its place.

-rw-rw-r- –

This computer file can be study and published by its proprietor and the proprietor team. It can only be studied by other customers.

You can set these authorizations using the chmod control. For example, this command:

chmod ugo=rwx filename

assigns study, make and perform authorizations to computer file proprietor user(u), group(g) and others (o). This other example:

chmod ug=rw,o=r filename

Assigns study authorizations to customer and team, and only study authorization to others.

Permissions can also be indicated and set using the octal number program. Each authorization is associated with a number:

Read = 4
Write = 2
Execute = 1

You need to come up with a variety for the computer file proprietor, another variety for the team and a last one for the other customers.

If you want to allocate study, make and perform authorizations to computer file proprietor, you add up the three principles, thus getting a 7. If you want to allocate the same authorizations to the team and others, you come up with three sevens. You can set these authorizations like this:

chmod 777 filename

If you set authorizations for a computer file with the following command:

chmod 764 filename

Then you are developing these permissions: study, make and perform for computer file proprietor (4+2+1=7), study for the team (4+2=6) and only study for others (4).

The following orders are equivalent:

chmod ug=rw,o=r filename
chmod 664 filename

The computer file authorizations schema allows you to apply security guidelines. It is not a wise decision to set computer file authorizations high (e.g.: 777) for all information.

It is important to think about it and allocate the right authorizations to the information, so customers can do their job, and we are sure each computer file is utilized only by the right people.

BIO Info:-

Sameer is a writer and blogger, loves to explore and write about Seo, blogging and various technology and internet trends. I have 7 years experience in IT.

evanderek

Leave a Comment