Rights management on Linux (chmod / chown)

This tutorial allows to understand and manage the files’ rights of your Linux system.

Introduction

Let’s start with a folder’s display in order to visualize the elements that both commands chmod and chown allow to change :

The first column tells us if we visualize a file (-), a link (l) or a folder (d) along with their rights (drwxr-xr-x+).
The following columns tells us the owner, the group, the size, the date of modification and the name.

The rights are defined by the characters 2 to 10 as indicated in the following table:

In individuality, we indicate the concernedentity User (u), Group (g), Other (o) or All (a) and the adding action (+) or right deletion (-).

Argument allowing to applicate the modification to the folder recursively.

The most common rights including:

<

pre>rw —- read / write file only for the creator.
rw-rw-r– read file for everyone, editable only by the creator or a person of are group and read by everyone.
rwxrwxr-x script that can be executed only by the creator or a person from are group and read by everyone.
drwxr-xr-x directory that can be modified only by the creator and read and browsed by everyone. </ pre>

Note that the right rw-rw-rw- is strongly discouraged, it is better to limit yourself to rw-rw-r – </ strong>

A generator of chmod permissions is available at the end of the tutorial.


chown / chgrp

The command chown allows to change the file/folder’s owner.
Only the owner and user root can change a file/folder’s rights.
It is also possible to change the owner and the group at the same time.
The command chgrp allows to change the file/folder’s group.

Argument allowing to applicate the modification to the folder recursively.


Generatorr

In order to change your permissions quicker, you can use the following generator :


Rights management on Linux (chmod / chown)
Vote