Objects for Linux File permissions are divided into three types (Mutual Exclusion ):
1. User (file owner)
2. Group (the group of the file owner, but not the user)
3. Other (other users, other than user and group)
In Linux, a three-digit binary number corresponds to the three permissions of the file (1 indicates that the permission is available, and 0 indicates that the permission is unavailable ):
1st-bit read R 100 4
2nd-bit write W 010 2
3rd-bit execution x 001 1
View Permissions
# Ls-l
In the first column, a total of 10 bits (drwxrwxrwx) represent the permissions of the file:
1) The first D indicates a directory. If "-" is displayed, it indicates that it is not a directory.
2) 2-4 represents the user's Permissions
3) 5-7 represents the Group permission
4) 8-10 indicates the permission of other.
For the last 9 digits:
R indicates read. Its value is 4.
W represents writeable (write), and its value is 2
X indicates executable, and its value is 1.
-Indicates that you do not have the required permissions. The value is 0.
Modify file permissions
# Chmod [ugoa] [+-=] [rwx] File Name
1) User
U stands for user
G stands for group
O Represents other
A Represents all people, including U, G, and O
2) Action
+ Indicates adding permissions.
-Indicates the permission to be deleted.
= Indicates that it is the only permission
3) Permission
Rwx can also be expressed in numbers, but it is difficult to calculate it by yourself, such as RW = 6
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. The Group and others have only the read permissions.
-Rwx ------ (700) only the owner has the read, write, and execute permissions.
-Rwxr-XR-X (755) only the owner has the read, write, and execute permissions. The Group and others have only the read and execute permissions.
-Rwx -- X (711) only the owner has the read, write, and execute permissions. The Group and others have only the execution permissions.
-RW-(666) everyone has the read and write permissions.
-Rwxrwxrwx (777) everyone has the read and write permissions and the maximum permission.