Linux operating system allows multiple users to work on the same system simultaneously without disrupting each other. Because of this feature, Individuals sharing access to files pose a risk exposing classified information or even data loss if other users access their files or directories. To address this, we can specify how much power each user has over a given file or directory by setting file permissions.

rwx

The nine characters following the file type denote the permissions in three triplets. A permission can be r for read access, w for write access, and x for execute. You need the r permission to list (ls) the contents of a directory. You need the x permission to enter (cd) a directory. You need the w permission to create files in or remove files from a directory

We already know that the output of ls -l starts with ten characters for each file. This screenshot shows a regular file (because the first character is a ).

permission examples

Some example combinations on files and directories are seen in this screenshot. The name of the file explains the permissions.

To summarise, the first rwx triplet represents the permissions for the user owner. The second triplet corresponds to the group owner; it specifies permissions for all members of that group. The third triplet defines permissions for all other users that are not the user owner and are not a member of the group owner.

setting permissions (chmod)

Permissions can be changed with chmod. The first example gives the user owner execute permissions.

This example removes the group owners read permission.

This example removes the others read permission.

This example gives all of them the write permission.

You don’t even have to type the a.

You can also set explicit permissions.

Feel free to make any kind of combination.

Even fishy combinations are accepted by chmod.

You can check this article for setting more advanced file permissions

The following two tabs change content below.
Ruwantha Nissanka is a Professional Cyber Security Engineer from Sri lanka with having a demonstrated history of providing cyber security services for multiple organizations in Sri Lanka. He is a positive person who wants to believe the best in others and he likes to help, encourage people and make them feel good.