Article Title: How does one understand how to use numbers to indicate file operation permissions in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
In Linux, When you view the detailed attribute list of all files in a path (ls-l), you will see the operation permission of the file, similar to the string of "drwxr-xr-x.
This string can be divided into four sections. The structure is "d + file owner operation permission + file owner group Operation permission + other people's operation permission ":
1. Section 1: the letter "d" in the example indicates the directory where the file is located.
2. Section 2: the string "rwx" in the example indicates the operation permission of the file owner.
3. In the third section, the string "r-x" in the example indicates the operation permissions of the file owner's group on some files.
4, section 4. the string "r-x" in the example indicates the operation permission of anyone except 2 and 3 for this file.
Generally, three numbers are used to indicate the ACL for reading, writing, and executing a file:
Run: 1
Write: 2
Read: 4
Write a number: 755. The three digits correspond to the preceding segments: 7 corresponds to the second segment, 5 corresponds to the third segment, and 5 corresponds to the fourth segment.
Meaning:
7: indicates the permission of the file owner. The value 4 + 2 + 1 = 7 indicates that the file owner has the power to kill the file and read, write, and execute the file at will.
5: indicates the permission of the group in which the file owner is located: 4 + 1 = 5. That is, the group in which the file owner is located has the read and execution permissions on the file and has no write permissions.
5: Same as above. Others have only read and execute permissions on the file and have no write permission.
Specific use:
# Chmod 755 file name.