The basic permissions on GNU/Linux with chmod are necessary to provide protection to the entire system.

Structure of basic permissions on files

Controlling the permissions of a system is a bit of a complicated task, however, it is also important, and this is because it is the only way that you can grant security to your system.


There are three important aspects to take into account in relation to file permissions, and they are: read, write and execute. Each one fulfills a function, and we leave it to you below:

Read permission (Read)

With read permission on a file, you have the ability to view all of its content without interruption. And, you only have to place Is list directory to show you all the information.

Note that if you have read permission on a directory, this does not guarantee that you can view the contents of its files without specific permission.

Write permission (Write)

If you have write permission to a file, you can make any modifications you want, including adding more information, or removing it.

Execute permission (Execute)

The execute permission gives you the option that the system can be executed as a program. And, if this is known as »foo», it can be done using any of the commands.

For example, in the case of scripts, they require read and execute permission, but when it comes to programs, they only need read permission.

Characters belonging to permissions

  • r: It refers to writing, and comes from Read
  • w: It means reading, and it is determined thanks to the word Write.
  • x: It's the execute permission, and it comes from eXecute.

How to change permissions?

To change the permissions you must use the command »chmod» What does change mode mean? It is the only one with which you can make the change, if you press the + key you have the option to add permissions, and with - to remove them.

  • Writes: chmod -w yourFile
  • And, in case you want to make an executable script, write the following: chmod + x yourScript.
  • Now, in case you want to add or remove all the attributes at the same time, you must place: chmod -rwx file, or, chmod +rwx file.
  • Another option is to use the = sign in case you want to do a mix of permissions. In this way, the writing and executing ones are eliminated, so that only the reading ones are available. So you have to write chmod=r file.

Note: Remember that, if you make a change in the permissions of your files, in the end you must place them in the same way they were to avoid failures in the functioning of the system.

Basic structure of permissions on directories

In this case, they are the same permissions as above, but have a different purpose.

Read permission on a directory

When a directory has read permission, you have the option to see all the files that are inside it, you can also use Is list directory to see them.

However, having the read permission does not ensure that you can read the information in their files, you must have another permission for this.

Write permission to a directory

With this permission you can add, delete or move the files to the directory, without having any problem.

Execute permission on a directory

The execute permission helps you to be able to use the directory name at the moment you enter the files.

In other words, what the permission does is that the directory is taken into account when searching for a program.

Users, groups and others

The three mentioned permits are stored in different places, and so that you can get them, we leave you the information below:

  • User (u): This option is created from the »user».
  • Group (g): It is established thanks to the word »group»
  • Others (or): Comes from "other".

If you write the command chmod =r file, you can move the permissions. And, creating the directory listing, using Is-I, the following appears: -r–r–r– 1 wada users 4096 apr 13 19:30 file.


The three r that are mentioned above, represent the three types of permissions that we know of today.

  • rwx: Belongs to »user».
  • —rx—: Be part of »group».
  • ——rx: And, this last one belongs to »others».

Also, you have the possibility to remove or eliminate the permissions for each of the owners. For example, the file in question is: -rwxr-xr-x 1 wada users 4096 Apr 13 19:30 file.

  • Now, if you want to move the group execution permissions to others, you must write the following: chmod gx, ox file.
  • In this way the file will be seen with these permissions: -rwxr–r–1 wada users 4096 Apr 13 19:30 file.
  • Now, if you want to move the write permission to user, type: -r-xr–r– 1 wada users 4096 Apr 13 19:30 file.
  • To add and move two permissions at the same time, type the following: chmod u-x+w file.
  • Then the file looks like: -rw-r–r– 1 wada users 4096 Apr 13 19:30 file.

Permissions in octal number format

What this means is that the combination of values ​​from each of the user groups will determine an octal number. For example, bit x represents 20, that is, 1, bit w is 1, which translates to 2, and bit r is 22, which is 4. Taking that into account, it is important to mention more details, such as:

  • r: 4
  • w: 2
  • x: 1

So, when you do the combination of the bits, either on or off, it also gives a result of eight possible combinations:

  • Without permissions: – – – = 0
  • With execution permission: – – x =1
  • Write Permission:-w-=2
  • Write and execute permissions: -wx=3
  • Read permission: r – – =4
  • Reading and execution: r–x = 5
  • Reading and writing: rw-=6
  • Read, write and execute:rwx=7

In addition, there are also some octal combinations, and the most frequent or used by users are the following:

  • 777 (rwx/rwx/rwx)
  • 755 (rwx/rx/rx)
  • 644 (rw-/r–/r–)
  • 655 (rw-/rx/rx)

Numeric notation format

  • rw–600: The owner has read and write permissions.
  • rwx-xx 711: The owner has read, write and execute permissions. The group and others, just the execute permission.
  • rwxr-xr-x 755: The owner has read, write and execute permissions. The group and others can read and execute the files.
  • rwxrwxrwx 777: Anyone can read, write, and execute the file.
  • r–400: The owner has permission to read the file, but it cannot be modified or executed. Therefore, neither the group nor others have control over it.
  • rw-r–640: The owner of the file can read and write. The group can read it, while others do not have permission to do anything.