Linux, there are three different types of users can access files or directories: The file owner, the same group of users, other users. The owner is typically the creator of the file, and the file owner automatically has read, write, and execute permissions on the file. The owner can allow the same group of users access to the file, as well as the access rights of the file to other users on the system. In this case, every user in the system can access the files and directories that the user owns.
Each file or directory has three groups of access rights, each group is represented by three bits, respectively, the read, write, and execute permissions of the file owner, and the read, write and execute permissions of the user belonging to the primary group, and the read, write, and execute permissions of other users in the system. When you use the LS-L command to display the details of a file or directory, the leftmost column is the file access permission.
Example:-rw-r--r--
The meaning of the representative is: normal file file Master Group user other users
-Represents a common document;
chmod [who] [+ |-| =] [mode] File name
chmod a+x filename means to assign to all users the ability to execute
U means "user", which is the owner of the file or directory
G means "group user", that is, all users with the same ID as the file owner
O means "other (others) users"
A means "all users"
Operation Symbols:
+ Add a permission
-Cancel a permission
= gives the given permission and cancels all other permissions, if any.
Setting the permissions represented by mode can be any combination of the following letters:
R readable
W Writable
X executable
Digital Setting Method:
0 means no permissions, 1 means executable permissions, 2 is writable, 4 is read, and then it is added. So the format of the numeric attribute should be 3 octal numbers from 0 to 7, in the Order of (U) (g) (O)
For example, if the owner of a file has the "read/write" permission, you need to put 4 (readable) + 2 (writable) =6 (read/write)
The general form of the digital setting method is:
chmod [mode] file name
Example: chmod 764 filename//The permission of the file is set to 764, i.e. rwx:4+2+1=7; rw-: 4+2=6; r--: 4
Linux directory Permissions