Input ls-l xxx. xxx. xxx in the terminal as the file name). Similar information will appear, mainly including:
-Rw-r --
A total of 10 digits, including:
The-at the top of the list indicates the type.
The three rw in the middle represents the owner user)
Then the three rw-represent the group)
The last three r groups are represented by another person, other)
Then explain the nine digits below:
R indicates that the file can be read)
W indicates that the file can be written)
X indicates that the file can be executed if it is a program)
-The permission has not been granted.
Now let's talk about modifying file permissions.
Enter: chmod o + w xxx. xxx on the terminal
Grant other users the permission to write the file xxx. xxx.
Chmod go-rw xxx. xxx
Deletes the read and write permissions of group groups and other persons in xxx. xxx.
Where:
U stands for the owner user)
G indicates the group in which the owner is located)
O stands for others, but not u and g other)
A Represents all people, including u, g, and o
R indicates that the file can be read)
W indicates that the file can be written)
X indicates that the file can be executed if it is a program)
Rwx can also be replaced by numbers.
R -- 4
W -- 2
X -- 1
--- 0
After everyone understands the above, we can easily understand the following common permissions:
-Rw -- 600) only the owner has the read and write permissions.
-Rw-r -- 644) only the owner has the read and write permissions, and the group and others only have the read permission-rwx -- 700) only the owner has the read and write permissions, execution permission-rwxr-xr-x 755) only the owner has the read, write, and execute permissions, group group and others only have read and execution permissions-rwx -- x 711) only the owner has read, write, and execution permissions. Group and others only have execution permissions.
-Rw-rw-rw-666) Everyone has read and write permissions
-Rwxrwxrwx777) everyone has the read/write and execution permissions.
Source: Magicbreaker Column
Use the ls-l command, such as the following:
Total 74434
-Rwxrwxr-x 2 user dba 39921 January 16 12:50 file1
Drwxrwxr-x 2 user dba 4096 January 16 15:29 folder
Total 74434 indicates the space occupied by all files in the directory
2 indicates the number of hard links to the file
39921 indicates the length of the file, expressed in bytes. If it is not a K-byte-rwxrwxr-x, it indicates the read and write permissions of the file or directory. The first value indicates 7 types of the file)
D directory l symbolic link pointing to another file) s socket file B Device File
C character device file p name MPs queue file-Common File
The first rwx indicates the file owner permission: r, w, x)
The second rwx indicates the default group permission for the file owner: r, w, x the permissions used by the third r-x System: r, x
Note: If the attribute of a file is-r --, the file owner can still write data to the file through redirection.
Chmod command: There are two types of commands: Symbol mode and absolute mode: