Home >Operation and Maintenance >Linux Operation and Maintenance >What is the role of r in linux
The role of r in Linux is to read the actual content of this file; having r permission in Linux means that you can read the directory structure list, which means you can view the file names and subdirectory names under the directory; directory The main content is to record the file name list and subdirectory list, not the actual place where the data is stored.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
What is the role of r in Linux?
The meaning of permissions (r, w, x) in Linux for directories and files
1. The meaning of permissions for directories
1. The first thing to understand The main content of the directory is to record the file name list and subdirectory list, not the actual place where the data is stored.
2. r permission: Having this permission means that you can read the directory structure list, which means you can view the file names and subdirectory names under the directory. Note: It only refers to the name.
3. w permission: Having this permission means having the permission to change the directory structure list. In short, the w permission of the directory is related to the change of the file name or subdirectory name under the directory. Note: refers to name. The details are as follows:
1) Create a new file or subdirectory in this directory.
2) Delete existing files or subdirectories in the directory (regardless of the permissions of the file or subdirectory). Note: This is very important. Whether the user can delete a file or directory depends on Whether the user has w permission on the directory where the file or directory is located.
3) Rename the files or subdirectories that already exist in the directory.
4) Transfer the location of the files or subdirectories in the directory.
4. permissions, you cannot switch to the directory, and you cannot execute any commands in the directory, even if you have r permissions for the directory. And if the user does not have x permission for a certain directory, the user cannot query the contents of the files in the directory. Note: it refers to the content. If you have r permission, you can view the file name list or subdirectory list under the directory. . Therefore, when you want to open a directory for anyone to browse, you should at least give it r and x permissions.
2. The meaning of permissions for files
1. It should also be understood that the file is where the actual data is contained, so the r, w, and x permissions for the file are related to its content. .
2. r permission: Used for this permission, it means that the actual content of this file can be read.
3. w permission: Having this permission means that you can edit, add or modify the content of the file. But it does not include deleting the file, because the conditions for deleting the file or directory are known from the meaning of the above permissions for the directory.
4. x permissions: Indicates that the file has permissions that can be executed by the system. Whether a file can be executed is determined by this permission and has no absolute relationship with the file name.
Recommended learning: "linux video tutorial"
The above is the detailed content of What is the role of r in linux. For more information, please follow other related articles on the PHP Chinese website!