【Give Permissions to a File in Linux】Step by Step Guide ▷ 2022

The security of the is one of the most popular and important points for its users, since it provides great control over which programs interact with which folders and files through the “chmod” permissions.

It is one of the more practical ways that Linux offers us to protect our files, al to define who can access, view and edit our files.

Knowing how to operate these permissions from your Linux distribution, It will be a big step in improving the security of your information. To learn everything you need to know about permissions “chmod”, Continue reading to be a professional in this operating system.

What are permissions in Linux and what types can be assigned to files so far?

The “chmod” function is one of the most effective and used when managing access permissions to folders, servers and Linux files. Basically all Linux distributions use these permissions to manage access to their folders. These permissions are assigned to different types of users, which are divided into three groups, matching the three digits usable in a chmod command.

These groups in particular are the following:

  • Owner: is the creator of the file or folder.
  • Cluster: modifiable parameter where we will decide who has access to the files.
  • Others: includes individual users.

To get to the permission numbers in the chmod command, keep in mind that each permission has a particular value assigned within the command syntax.

With this information, the values ​​of each permission are assigned as follows:

  • Reading (r): 4
  • Writing (w): two
  • Execution (x): 1
See also  【 Create Pro Account on TikTok 】 Step by Step Guide ▷ 2022

With this information, we must learn to add and manage the values ​​of each permission, with the aim of using them in a more efficient way. For example, a read and execute permission would equal 5 (4 + 1), chmod permission commands are executable from the Linux command prompt, and there are various types and combinations that grant different permissions for files and folders.

The most frequently used types of chmod permissions are:

  • chmod 777: This permission enables all users to read, write, and execute the file or folder.
  • chmod 644 – This permission disables the ability to write to and read the file or folder for all users except the owner.
  • chmod 755: Remove execute permissions for all users. Both other users and the owner will be able to read and write, but only the owner will be able to execute the file or folder.
  • chmod 700 – Removes all file action permissions for users. Only the owner will maintain the permissions to read, write and execute the file.
  • chmod 666: This option enables read and write permissions for all users. Only the owner will have execute permissions.

Commands to assign and manage permissions in Linux What are they and how is each one different?

A chmod command is used in Linux to access and change the permissions of a file or folder. Its name is short for “change mode”, that is, change mode in English.

On Linux, the options for setting file and folder security parameters are closely related to the specific value each permission has, and their usage combinations, like so:

  • 0 = — : no access
  • 1 = –x : execute
  • 2 = -w- : write
  • 3 = -wx : write and execute
  • 4 = r– : read
  • 5 = rx : read and execute
  • 6 = rw- : read and write
  • 7 = rwx : read, write and execute
See also  【 Configure Hosting Mail in Gmail 】 Step by Step Guide ▷ 2022

This list shows the types of permissions assigned to each number, where “r” represents the read permission, “w” permission to write and “x” the execution of the file or folder. The combination of each value Allows you to give or restrict different types of users the freedoms and access to certain files.

Learn step by step how to give permissions to a folder in Linux correctly with the CHMOD command

use a chmod command in linux it is quite simple.

It is used exclusively through the command terminal, to enter it, it follows a very simple syntax, described below:

  • chmod type permissions file path

Using this formation, together with the types of command, we can manage the access permissions of a file or folder by specifying the path of the element we want to modify.

To manage the permissions of a file for all users, all we have to do is open the terminal and enter the command, which would be a combination of the permission numbers, using them in conjunction with the syntax seen above:

  • Chmod 777 /home/InternetPasoaPaso/InternetPasoaPaso.docx

Through this command, we grant all users read, write and execute permissions to file “InternetPasoaPaso.docx”.

Instead, to remove these permissions for all users except the owner, use the following command:

  • Chmod 666 /home/InternetPasoaPaso/InternetPasoaPaso.docx

Thus, all modify, read and execute permissions will be removed the file for all users, leaving the file under the exclusive control of its owner.

Loading Facebook Comments ...
Loading Disqus Comments ...