Detailed explanation of Linux file permissions
Linux system has very strict control over file permissions. If the operator performs a certain operation on a file, You must have the corresponding operation authority to execute successfully. The authority types generally include read, write, and execute, and the corresponding letters are r, w, and x.
If we want to express all the permission details of a file, there are two ways:
1, ten-digit binary representation, (the three attribute groups use binary digits each, and then Add one highest digit for a total of ten digits), which can be simplified to three-digit octal form
2, twelve-digit binary representation (twelve binary digits), which can be simplified to four-digit octal form
Ten-digit permission representation
Common permission representations are:
-rw——- (600) Only the owner Has read and write permissions.
-rw-r–r– (644) Only the owner has read and write permissions; and group users and other users only have read permissions.
-rwx—— (700) Only the owner has read, write, and execute permissions.
-rwxr-xr-x (755) The owner has read, write, and execute permissions; while group users and other users only have read, execute permissions.
-rwx–x–x (711) The owner has read, write, and execute permissions; while group users and other users only have execute permissions.
-rw-rw-rw- (666) All users have file read and write permissions.
-rwxrwxrwx (777) All users have read, write, and execute permissions.
Analysis of the last nine digits: Linux permissions have a total of three subgroups, and each subgroup uses three positions to define three operations (read, write, execute) permissions, which together are the last nine permissions bit. The above uses characters to indicate permissions, where – means no permission, r means read permission, w means write permission, and x means execute permission.
In fact, the meaning of each position of the last nine digits (representing a certain authority of a certain group) is fixed. If the presence or absence of each position authority is replaced by binary numbers 1 and 0, Then read-only, write-only, and execute-only permissions can be represented by three-digit binary numbers as
r– = 100
-w- = 010
–x = 001
— = 000
Explanation about the first highest digit: The above mentioned the meaning of the last nine digits in the permission representation, and the remaining first The bit represents the type of the file, which can be one of the following:
d represents the directory (directroy)
-represents the file (regular file)
s represents the socket file (socket)
p represents the pipe file (pipe) or named pipe file (named pipe)
l represents the Symbolic link file (symbolic link)
b means that the file is a block-oriented device file (block-oriented device file)
c means that the file is character-oriented Device file (charcter-oriented device file)
Recommended tutorial: “Linux Operation and Maintenance”
The above is the detailed content of Linux file permissions. For more information, please pay attention to other related articles on 1024programmer.com!