1, Command introduction:
Chmod is used to change the relevant permissions of the system files or directories, readable, writable, executable, etc.
2. Command format:
chmod [Options] Mode file
3. Command parameters:
Necessary parameters:
-C When a change occurs, the report processes the information
-F error Message not output
-R handles all files in the specified directory and its subdirectories
-V Run-time display verbose processing information
Select parameters:
--reference=< directory or File > set to have the same permissions as the specified directory or file
--version displaying version information
< permissions >+< permissions settings > Allow directories or files within a permission scope to have the specified permissions
< permission scope >-< permission settings > Delete permission scope of directory or file specified permission
< permission range >=< permissions settings > Set permissions for a directory or a file in a permission range for a specified value
Permission range:
U: The current user of the directory or file
G: The current group of directories or files
O: Users or groups other than the current user or group of directories or files
A: All Users and Groups
Permission code:
R: Read permission, denoted by the number 4
W: Write permission, denoted by the number 2
X: Execute permission, denoted by the number 1
-: Delete permission, denoted by the number 0
S: Special Permissions
There are two ways to use this command. One is a text-setting method that contains letters and operator expressions, and the other is a digital setting method that contains numbers.
1). Text Setting Method:
chmod [who] [+ | - | =] [mode] File name
2). Digital Setting method
We must first understand the meaning of the attributes represented by numbers: 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 you want the owner of a file to have "read/write" Two permissions, you need to have 4 (readable) +2 (writable) =6 (read/write).
The general form of the digital setting method is:
chmod [mode] file name
The numbers correspond to characters as follows:
R=4,w=2,x=1
To rwx the property, 4+2+1=7
To rw-the attribute then 4+2=6;
To r-x the property, 4+1=5.
Linux command: chmod